summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1997-08-04 19:26:26 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1997-08-04 19:26:26 +0000
commit73d7e506331c4d94cf190afc8e971bfcaa8fcfee (patch)
tree2d7924022671484045c1371140b2db29a2a98ae8
parentfb89d0cbe5641bec1cbdcc4473fbccfe84b2f3ed (diff)
save errno in sigchld handlers
-rw-r--r--bin/csh/proc.c6
-rw-r--r--games/sail/pl_1.c4
-rw-r--r--gnu/usr.bin/cvs/src/server.c3
-rw-r--r--gnu/usr.bin/sudo/sudo/logging.c5
-rw-r--r--libexec/comsat/comsat.c5
-rw-r--r--libexec/ftpd/ftpd.c8
-rw-r--r--libexec/rpc.yppasswdd/rpc.yppasswdd.c5
-rw-r--r--libexec/uucpd/uucpd.c4
-rw-r--r--sbin/mount_portal/mount_portal.c6
-rw-r--r--sbin/nfsd/nfsd.c7
-rw-r--r--sbin/nfsiod/nfsiod.c4
-rw-r--r--usr.bin/mail/popen.c6
-rw-r--r--usr.bin/rdist/child.c6
-rw-r--r--usr.bin/script/script.c6
-rw-r--r--usr.bin/tn3270/sys_curses/system.c6
-rw-r--r--usr.sbin/amd/amd/sched.c4
-rw-r--r--usr.sbin/cron/cron.c6
-rw-r--r--usr.sbin/inetd/inetd.c6
-rw-r--r--usr.sbin/lpr/lpd/lpd.c6
-rw-r--r--usr.sbin/pcmciad/pcmciad.c4
-rw-r--r--usr.sbin/pppd/main.c7
-rw-r--r--usr.sbin/syslogd/syslogd.c2
-rw-r--r--usr.sbin/ypserv/ypserv/ypserv.c10
23 files changed, 93 insertions, 33 deletions
diff --git a/bin/csh/proc.c b/bin/csh/proc.c
index b1ea8ec44a1..1e1f52838f9 100644
--- a/bin/csh/proc.c
+++ b/bin/csh/proc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: proc.c,v 1.5 1997/07/25 18:58:15 mickey Exp $ */
+/* $OpenBSD: proc.c,v 1.6 1997/08/04 19:24:02 deraadt Exp $ */
/* $NetBSD: proc.c,v 1.9 1995/04/29 23:21:33 mycroft Exp $ */
/*-
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)proc.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$OpenBSD: proc.c,v 1.5 1997/07/25 18:58:15 mickey Exp $";
+static char rcsid[] = "$OpenBSD: proc.c,v 1.6 1997/08/04 19:24:02 deraadt Exp $";
#endif
#endif /* not lint */
@@ -92,6 +92,7 @@ pchild(notused)
register struct process *fp;
register int pid;
extern int insource;
+ int save_errno = errno;
union wait w;
int jobflags;
struct rusage ru;
@@ -107,6 +108,7 @@ loop:
goto loop;
}
pnoprocesses = pid == -1;
+ errno = save_errno;
return;
}
for (pp = proclist.p_next; pp != NULL; pp = pp->p_next)
diff --git a/games/sail/pl_1.c b/games/sail/pl_1.c
index 0abd1ac3a7b..f215cd91ab6 100644
--- a/games/sail/pl_1.c
+++ b/games/sail/pl_1.c
@@ -130,7 +130,8 @@ child()
{
union wait status;
int pid;
-
+ int save_errno = errno;
+
(void) signal(SIGCHLD, SIG_IGN);
do {
pid = wait3((int *)&status, WNOHANG, (struct rusage *)0);
@@ -138,4 +139,5 @@ child()
hasdriver = 0;
} while (pid > 0);
(void) signal(SIGCHLD, child);
+ errno = save_errno;
}
diff --git a/gnu/usr.bin/cvs/src/server.c b/gnu/usr.bin/cvs/src/server.c
index ea40a4c8901..98c7a76e69d 100644
--- a/gnu/usr.bin/cvs/src/server.c
+++ b/gnu/usr.bin/cvs/src/server.c
@@ -3852,9 +3852,12 @@ static void wait_sig (sig)
int sig;
{
int status;
+ int save_errno = errno;
+
pid_t r = wait (&status);
if (r == command_pid)
command_pid_is_dead++;
+ errno = save_errno;
}
#endif
diff --git a/gnu/usr.bin/sudo/sudo/logging.c b/gnu/usr.bin/sudo/sudo/logging.c
index 0feb8d9cccc..03592f194db 100644
--- a/gnu/usr.bin/sudo/sudo/logging.c
+++ b/gnu/usr.bin/sudo/sudo/logging.c
@@ -37,7 +37,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: logging.c,v 1.2 1996/11/17 16:34:00 millert Exp $";
+static char rcsid[] = "$Id: logging.c,v 1.3 1997/08/04 19:24:52 deraadt Exp $";
#endif /* lint */
#include "config.h"
@@ -536,10 +536,13 @@ static void send_mail()
static RETSIGTYPE reapchild(sig)
int sig;
{
+ int save_errno = errno;
+
(void) wait(NULL);
#ifndef POSIX_SIGNALS
(void) signal(SIGCHLD, reapchild);
#endif /* POSIX_SIGNALS */
+ errno = save_errno;
}
diff --git a/libexec/comsat/comsat.c b/libexec/comsat/comsat.c
index 65f14fb26d0..a5cd2f2259b 100644
--- a/libexec/comsat/comsat.c
+++ b/libexec/comsat/comsat.c
@@ -39,7 +39,7 @@ static char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)comsat.c 8.1 (Berkeley) 6/4/93";*/
-static char rcsid[] = "$Id: comsat.c,v 1.4 1996/12/22 03:41:12 tholo Exp $";
+static char rcsid[] = "$Id: comsat.c,v 1.5 1997/08/04 19:25:07 deraadt Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -141,7 +141,10 @@ void
reapchildren(signo)
int signo;
{
+ int save_errno = errno;
+
while (wait3(NULL, WNOHANG, NULL) > 0);
+ errno = save_errno;
}
void
diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c
index a59df1b165f..6f6e90743d6 100644
--- a/libexec/ftpd/ftpd.c
+++ b/libexec/ftpd/ftpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ftpd.c,v 1.42 1997/07/25 19:41:16 mickey Exp $ */
+/* $OpenBSD: ftpd.c,v 1.43 1997/08/04 19:25:09 deraadt Exp $ */
/* $NetBSD: ftpd.c,v 1.15 1995/06/03 22:46:47 mycroft Exp $ */
/*
@@ -2060,7 +2060,11 @@ static void
reapchild(signo)
int signo;
{
- while (wait3(NULL, WNOHANG, NULL) > 0);
+ int save_errno = errno;
+
+ while (wait3(NULL, WNOHANG, NULL) > 0)
+ ;
+ errno = save_errno;
}
void
diff --git a/libexec/rpc.yppasswdd/rpc.yppasswdd.c b/libexec/rpc.yppasswdd/rpc.yppasswdd.c
index dbbe6ca7c4b..b9b89beaf83 100644
--- a/libexec/rpc.yppasswdd/rpc.yppasswdd.c
+++ b/libexec/rpc.yppasswdd/rpc.yppasswdd.c
@@ -30,7 +30,7 @@
*/
#ifndef LINT
-static char rcsid[] = "$Id: rpc.yppasswdd.c,v 1.6 1997/07/21 19:22:56 deraadt Exp $";
+static char rcsid[] = "$Id: rpc.yppasswdd.c,v 1.7 1997/08/04 19:25:11 deraadt Exp $";
#endif
#include <sys/types.h>
@@ -175,6 +175,9 @@ yppasswddprog_1(rqstp, transp)
void
sig_child()
{
+ int save_errno = errno;
+
while (wait3((int *) NULL, WNOHANG, (struct rusage *) NULL) > 0)
;
+ errno = save_errno;
}
diff --git a/libexec/uucpd/uucpd.c b/libexec/uucpd/uucpd.c
index ccf1d4bf2cf..78ba5a36bcb 100644
--- a/libexec/uucpd/uucpd.c
+++ b/libexec/uucpd/uucpd.c
@@ -42,7 +42,7 @@ char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)uucpd.c 5.10 (Berkeley) 2/26/91";*/
-static char rcsid[] = "$Id: uucpd.c,v 1.9 1997/06/02 06:28:13 deraadt Exp $";
+static char rcsid[] = "$Id: uucpd.c,v 1.10 1997/08/04 19:25:13 deraadt Exp $";
#endif /* not lint */
/*
@@ -246,6 +246,7 @@ void
dologout()
{
union wait status;
+ int save_errno = errno;
int pid, wtmp;
#ifdef BSDINETD
@@ -263,6 +264,7 @@ dologout()
(void) close(wtmp);
}
}
+ errno = save_errno;
}
/*
diff --git a/sbin/mount_portal/mount_portal.c b/sbin/mount_portal/mount_portal.c
index 55911432ffa..a6f38b3a81c 100644
--- a/sbin/mount_portal/mount_portal.c
+++ b/sbin/mount_portal/mount_portal.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mount_portal.c,v 1.11 1997/06/25 18:25:47 kstailey Exp $ */
+/* $OpenBSD: mount_portal.c,v 1.12 1997/08/04 19:25:19 deraadt Exp $ */
/* $NetBSD: mount_portal.c,v 1.8 1996/04/13 01:31:54 jtc Exp $ */
/*
@@ -47,7 +47,7 @@ char copyright[] =
#if 0
static char sccsid[] = "@(#)mount_portal.c 8.6 (Berkeley) 4/26/95";
#else
-static char rcsid[] = "$OpenBSD: mount_portal.c,v 1.11 1997/06/25 18:25:47 kstailey Exp $";
+static char rcsid[] = "$OpenBSD: mount_portal.c,v 1.12 1997/08/04 19:25:19 deraadt Exp $";
#endif
#endif /* not lint */
@@ -87,12 +87,14 @@ static void
sigchld(sig)
int sig;
{
+ int save_errno = errno;
pid_t pid;
while ((pid = waitpid((pid_t) -1, NULL, WNOHANG)) > 0)
;
if (pid < 0 && errno != ECHILD)
syslog(LOG_WARNING, "waitpid: %m");
+ errno = save_errno;
}
static void
diff --git a/sbin/nfsd/nfsd.c b/sbin/nfsd/nfsd.c
index 554bcc1214e..186f2d2f086 100644
--- a/sbin/nfsd/nfsd.c
+++ b/sbin/nfsd/nfsd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfsd.c,v 1.6 1997/06/29 11:10:32 provos Exp $ */
+/* $OpenBSD: nfsd.c,v 1.7 1997/08/04 19:25:21 deraadt Exp $ */
/* $NetBSD: nfsd.c,v 1.19 1996/02/18 23:18:56 mycroft Exp $ */
/*
@@ -624,6 +624,9 @@ void
reapchild(signo)
int signo;
{
+ int save_errno = errno;
- while (wait3(NULL, WNOHANG, NULL) > 0);
+ while (wait3(NULL, WNOHANG, NULL) > 0)
+ ;
+ errno = save_errno;
}
diff --git a/sbin/nfsiod/nfsiod.c b/sbin/nfsiod/nfsiod.c
index ee596a50641..f3d4d7bb692 100644
--- a/sbin/nfsiod/nfsiod.c
+++ b/sbin/nfsiod/nfsiod.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfsiod.c,v 1.4 1997/01/15 23:41:35 millert Exp $ */
+/* $OpenBSD: nfsiod.c,v 1.5 1997/08/04 19:25:22 deraadt Exp $ */
/* $NetBSD: nfsiod.c,v 1.12 1996/02/20 16:06:55 fvdl Exp $ */
/*
@@ -165,9 +165,11 @@ void
reapchild(signo)
int signo;
{
+ int save_errno = errno;
while (wait3(NULL, WNOHANG, NULL) > 0)
;
+ errno = save_errno;
}
void
diff --git a/usr.bin/mail/popen.c b/usr.bin/mail/popen.c
index 2de89722fe7..b542ae4d14c 100644
--- a/usr.bin/mail/popen.c
+++ b/usr.bin/mail/popen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: popen.c,v 1.10 1997/07/14 16:09:07 millert Exp $ */
+/* $OpenBSD: popen.c,v 1.11 1997/08/04 19:25:50 deraadt Exp $ */
/* $NetBSD: popen.c,v 1.6 1997/05/13 06:48:42 mikel Exp $ */
/*
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)popen.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$OpenBSD: popen.c,v 1.10 1997/07/14 16:09:07 millert Exp $";
+static char rcsid[] = "$OpenBSD: popen.c,v 1.11 1997/08/04 19:25:50 deraadt Exp $";
#endif
#endif /* not lint */
@@ -346,6 +346,7 @@ sigchild(signo)
int pid;
union wait status;
register struct child *cp;
+ int save_errno = errno;
while ((pid =
wait3((int *)&status, WNOHANG, (struct rusage *)0)) > 0) {
@@ -357,6 +358,7 @@ sigchild(signo)
cp->status = status;
}
}
+ errno = save_errno;
}
union wait wait_status;
diff --git a/usr.bin/rdist/child.c b/usr.bin/rdist/child.c
index cfb6e47e3e6..e6a795ee31b 100644
--- a/usr.bin/rdist/child.c
+++ b/usr.bin/rdist/child.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: child.c,v 1.4 1996/07/25 05:30:59 millert Exp $ */
+/* $OpenBSD: child.c,v 1.5 1997/08/04 19:25:54 deraadt Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -35,7 +35,7 @@
#ifndef lint
static char RCSid[] =
-"$OpenBSD: child.c,v 1.4 1996/07/25 05:30:59 millert Exp $";
+"$OpenBSD: child.c,v 1.5 1997/08/04 19:25:54 deraadt Exp $";
static char sccsid[] = "@(#)docmd.c 5.1 (Berkeley) 6/6/85";
@@ -275,6 +275,7 @@ static int waitproc(statval, block)
static void reap()
{
register CHILD *pc;
+ int save_errno = errno;
int status = 0;
pid_t pid;
@@ -322,6 +323,7 @@ static void reap()
(void) signal(SIGCHLD, reap);
debugmsg(DM_CALL, "reap() done\n");
+ errno = save_errno;
}
/*
diff --git a/usr.bin/script/script.c b/usr.bin/script/script.c
index cb7cbb3b243..d24277c2868 100644
--- a/usr.bin/script/script.c
+++ b/usr.bin/script/script.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: script.c,v 1.7 1997/07/25 22:03:08 mickey Exp $ */
+/* $OpenBSD: script.c,v 1.8 1997/08/04 19:25:56 deraadt Exp $ */
/* $NetBSD: script.c,v 1.3 1994/12/21 08:55:43 jtc Exp $ */
/*
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)script.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$OpenBSD: script.c,v 1.7 1997/07/25 22:03:08 mickey Exp $";
+static char rcsid[] = "$OpenBSD: script.c,v 1.8 1997/08/04 19:25:56 deraadt Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -156,6 +156,7 @@ finish(signo)
int signo;
{
register int die, pid;
+ int save_errno = errno;
union wait status;
die = 0;
@@ -165,6 +166,7 @@ finish(signo)
if (die)
done();
+ errno = save_errno;
}
void
diff --git a/usr.bin/tn3270/sys_curses/system.c b/usr.bin/tn3270/sys_curses/system.c
index 429a52a9d19..00570365a83 100644
--- a/usr.bin/tn3270/sys_curses/system.c
+++ b/usr.bin/tn3270/sys_curses/system.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: system.c,v 1.5 1997/04/19 20:53:46 deraadt Exp $ */
+/* $OpenBSD: system.c,v 1.6 1997/08/04 19:25:59 deraadt Exp $ */
/*-
* Copyright (c) 1988 The Regents of the University of California.
@@ -35,7 +35,7 @@
#ifndef lint
/*static char sccsid[] = "from: @(#)system.c 4.5 (Berkeley) 4/26/91";*/
-static char rcsid[] = "$OpenBSD: system.c,v 1.5 1997/04/19 20:53:46 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: system.c,v 1.6 1997/08/04 19:25:59 deraadt Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -592,6 +592,7 @@ shell_continue()
static void
child_died(code)
{
+ int save_errno = errno;
union wait status;
register int pid;
@@ -616,6 +617,7 @@ child_died(code)
}
}
signal(SIGCHLD, child_died);
+ errno = save_errno;
}
diff --git a/usr.sbin/amd/amd/sched.c b/usr.sbin/amd/amd/sched.c
index 82d949e314a..76988a247f1 100644
--- a/usr.sbin/amd/amd/sched.c
+++ b/usr.sbin/amd/amd/sched.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* from: @(#)sched.c 8.1 (Berkeley) 6/6/93
- * $Id: sched.c,v 1.1 1995/10/18 08:47:12 deraadt Exp $
+ * $Id: sched.c,v 1.2 1997/08/04 19:26:05 deraadt Exp $
*/
/*
@@ -202,6 +202,7 @@ void sigchld(sig)
int sig;
{
union wait w;
+ int save_errno = errno;
int pid;
#ifdef SYS5_SIGNALS
@@ -240,6 +241,7 @@ int sig;
#endif /* SYS5_SIGNALS */
if (select_intr_valid)
longjmp(select_intr, sig);
+ errno = save_errno;
}
/*
diff --git a/usr.sbin/cron/cron.c b/usr.sbin/cron/cron.c
index 0a9d67616c4..30e0c4f0909 100644
--- a/usr.sbin/cron/cron.c
+++ b/usr.sbin/cron/cron.c
@@ -16,7 +16,7 @@
*/
#if !defined(lint) && !defined(LINT)
-static char rcsid[] = "$Id: cron.c,v 1.2 1996/09/15 09:28:14 deraadt Exp $";
+static char rcsid[] = "$Id: cron.c,v 1.3 1997/08/04 19:26:08 deraadt Exp $";
#endif
@@ -252,6 +252,7 @@ cron_sleep() {
#ifdef USE_SIGCHLD
static void
sigchld_handler(x) {
+ int save_errno = errno;
WAIT_T waiter;
PID_T pid;
@@ -265,10 +266,12 @@ sigchld_handler(x) {
case -1:
Debug(DPROC,
("[%d] sigchld...no children\n", getpid()))
+ errno = save_errno;
return;
case 0:
Debug(DPROC,
("[%d] sigchld...no dead kids\n", getpid()))
+ errno = save_errno;
return;
default:
Debug(DPROC,
@@ -276,6 +279,7 @@ sigchld_handler(x) {
getpid(), pid, WEXITSTATUS(waiter)))
}
}
+ errno = save_errno;
}
#endif /*USE_SIGCHLD*/
diff --git a/usr.sbin/inetd/inetd.c b/usr.sbin/inetd/inetd.c
index c09bf4fc01a..67a19e8c002 100644
--- a/usr.sbin/inetd/inetd.c
+++ b/usr.sbin/inetd/inetd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: inetd.c,v 1.36 1997/07/22 21:12:28 deraadt Exp $ */
+/* $OpenBSD: inetd.c,v 1.37 1997/08/04 19:26:10 deraadt Exp $ */
/* $NetBSD: inetd.c,v 1.11 1996/02/22 11:14:41 mycroft Exp $ */
/*
* Copyright (c) 1983,1991 The Regents of the University of California.
@@ -41,7 +41,7 @@ char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)inetd.c 5.30 (Berkeley) 6/3/91";*/
-static char rcsid[] = "$OpenBSD: inetd.c,v 1.36 1997/07/22 21:12:28 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: inetd.c,v 1.37 1997/08/04 19:26:10 deraadt Exp $";
#endif /* not lint */
/*
@@ -578,6 +578,7 @@ reapchild(sig)
{
int status;
int pid;
+ int save_errno = errno;
register struct servtab *sep;
for (;;) {
@@ -604,6 +605,7 @@ reapchild(sig)
sep->se_service, sep->se_fd);
}
}
+ errno = save_errno;
}
int setconfig __P((void));
diff --git a/usr.sbin/lpr/lpd/lpd.c b/usr.sbin/lpr/lpd/lpd.c
index 3a462cac510..d883a03b184 100644
--- a/usr.sbin/lpr/lpd/lpd.c
+++ b/usr.sbin/lpr/lpd/lpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lpd.c,v 1.14 1997/07/19 07:11:43 deraadt Exp $ */
+/* $OpenBSD: lpd.c,v 1.15 1997/08/04 19:26:13 deraadt Exp $ */
/* $NetBSD: lpd.c,v 1.7 1996/04/24 14:54:06 mrg Exp $ */
/*
@@ -45,7 +45,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)lpd.c 8.7 (Berkeley) 5/10/95";
#else
-static char rcsid[] = "$OpenBSD: lpd.c,v 1.14 1997/07/19 07:11:43 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: lpd.c,v 1.15 1997/08/04 19:26:13 deraadt Exp $";
#endif
#endif /* not lint */
@@ -302,9 +302,11 @@ reapchild(signo)
int signo;
{
int status;
+ int save_errno = errno;
while (waitpid((pid_t)-1, &status, WNOHANG) > 0)
;
+ errno = save_errno;
}
static void
diff --git a/usr.sbin/pcmciad/pcmciad.c b/usr.sbin/pcmciad/pcmciad.c
index b744928ca5b..c204ac08c9b 100644
--- a/usr.sbin/pcmciad/pcmciad.c
+++ b/usr.sbin/pcmciad/pcmciad.c
@@ -450,10 +450,14 @@ child_death(sig)
int sig;
{
int status;
+ int save_errno = errno;
+
if (wait(&status) == -1) {
syslog(LOG_ERR, "wait error for signaled child: %m");
+ errno = save_errno;
return;
}
if (WEXITSTATUS(status) == 2)
speaker_ok = 0;
+ errno = save_errno;
}
diff --git a/usr.sbin/pppd/main.c b/usr.sbin/pppd/main.c
index 72373bec314..dc8b1983ed5 100644
--- a/usr.sbin/pppd/main.c
+++ b/usr.sbin/pppd/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.16 1997/07/25 20:12:16 mickey Exp $ */
+/* $OpenBSD: main.c,v 1.17 1997/08/04 19:26:18 deraadt Exp $ */
/*
* main.c - Point-to-Point Protocol main module
@@ -20,7 +20,7 @@
*/
#ifndef lint
-static char rcsid[] = "$OpenBSD: main.c,v 1.16 1997/07/25 20:12:16 mickey Exp $";
+static char rcsid[] = "$OpenBSD: main.c,v 1.17 1997/08/04 19:26:18 deraadt Exp $";
#endif
#include <stdio.h>
@@ -940,7 +940,10 @@ static void
chld(sig)
int sig;
{
+ int save_errno = errno;
+
reap_kids();
+ errno = save_errno;
}
diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c
index 7a465b7c2b0..1b4334e30cd 100644
--- a/usr.sbin/syslogd/syslogd.c
+++ b/usr.sbin/syslogd/syslogd.c
@@ -768,9 +768,11 @@ reapchild(signo)
int signo;
{
union wait status;
+ int save_errno = errno;
while (wait3((int *)&status, WNOHANG, (struct rusage *)NULL) > 0)
;
+ errno = save_errno;
}
/*
diff --git a/usr.sbin/ypserv/ypserv/ypserv.c b/usr.sbin/ypserv/ypserv/ypserv.c
index d253346ac79..34a853cabb1 100644
--- a/usr.sbin/ypserv/ypserv/ypserv.c
+++ b/usr.sbin/ypserv/ypserv/ypserv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ypserv.c,v 1.9 1997/04/12 00:14:28 deraadt Exp $ */
+/* $OpenBSD: ypserv.c,v 1.10 1997/08/04 19:26:25 deraadt Exp $ */
/*
* Copyright (c) 1994 Mats O Jansson <moj@stacken.kth.se>
@@ -32,7 +32,7 @@
*/
#ifndef LINT
-static char rcsid[] = "$OpenBSD: ypserv.c,v 1.9 1997/04/12 00:14:28 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: ypserv.c,v 1.10 1997/08/04 19:26:25 deraadt Exp $";
#endif
#include "yp.h"
@@ -505,7 +505,11 @@ char *argv[];
void
sig_child()
{
- while (wait3((int *)NULL, WNOHANG, (struct rusage *)NULL) > 0);
+ int save_errno = errno;
+
+ while (wait3((int *)NULL, WNOHANG, (struct rusage *)NULL) > 0)
+ ;
+ errno = save_errno;
}
void