summary refs log tree commit diff
path: root/src/usr.bin/calendar/io.c
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2017-09-14 13:29:21 +0200
committerLeah Neukirchen <leah@vuxu.org>2017-09-14 13:29:21 +0200
commit21aa46256916122007b3db3ebc1096ad34105957 (patch)
tree6feb7fdbcaa936a5705cedf9b45262a01da55036 /src/usr.bin/calendar/io.c
parentc6fe3a3f95b447a221ba51f9807d796d88a0580d (diff)
downloadoutils-21aa46256916122007b3db3ebc1096ad34105957.tar.gz
outils-21aa46256916122007b3db3ebc1096ad34105957.tar.xz
outils-21aa46256916122007b3db3ebc1096ad34105957.zip
cvs update
Diffstat (limited to 'src/usr.bin/calendar/io.c')
-rw-r--r--src/usr.bin/calendar/io.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/usr.bin/calendar/io.c b/src/usr.bin/calendar/io.c
index e4cb689..8abe799 100644
--- a/src/usr.bin/calendar/io.c
+++ b/src/usr.bin/calendar/io.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: io.c,v 1.44 2016/08/31 09:38:47 jsg Exp $	*/
+/*	$OpenBSD: io.c,v 1.46 2017/08/21 21:41:13 deraadt Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993, 1994
@@ -89,13 +89,9 @@ cal(void)
 		if (strncmp(buf, "LANG=", 5) == 0) {
 			(void) setlocale(LC_ALL, buf + 5);
 			setnnames();
-			/* XXX remove KOI8 lines after 5.9 is out */
 			if (!strcmp(buf + 5, "ru_RU.UTF-8") ||
 			    !strcmp(buf + 5, "uk_UA.UTF-8") ||
-			    !strcmp(buf + 5, "by_BY.UTF-8") ||
-			    !strcmp(buf + 5, "ru_RU.KOI8-R") ||
-			    !strcmp(buf + 5, "uk_UA.KOI8-U") ||
-			    !strcmp(buf + 5, "by_BY.KOI8-B")) {
+			    !strcmp(buf + 5, "by_BY.UTF-8")) {
 				bodun_maybe++;
 				bodun = 0;
 				free(prefix);
@@ -389,6 +385,7 @@ closecal(FILE *fp)
 	struct stat sbuf;
 	int nread, pdes[2], status;
 	char buf[1024];
+	pid_t pid;
 
 	if (!doall)
 		return;
@@ -398,7 +395,7 @@ closecal(FILE *fp)
 		goto done;
 	if (pipe(pdes) < 0)
 		goto done;
-	switch (vfork()) {
+	switch ((pid = vfork())) {
 	case -1:			/* error */
 		(void)close(pdes[0]);
 		(void)close(pdes[1]);
@@ -425,8 +422,10 @@ closecal(FILE *fp)
 		(void)write(pdes[1], buf, nread);
 	(void)close(pdes[1]);
 done:	(void)fclose(fp);
-	while (wait(&status) >= 0)
-		;
+	while (waitpid(pid, &status, 0) == -1) {
+		if (errno != EINTR)
+			break;
+	}
 }