diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-08-06 01:45:27 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-08-06 01:45:27 +0000 |
commit | 9d40e48734d942a6950e151e86c2be4c8e2799fc (patch) | |
tree | 0209e961ea2493dcc4fa52d3b8670147993d191d | |
parent | 2cc42eb6c340fb27ad8a95412f788354f0ed5a66 (diff) |
do not clobber errno in signal handlers
-rw-r--r-- | sbin/mountd/mountd.c | 14 | ||||
-rw-r--r-- | sbin/ping/ping.c | 9 | ||||
-rw-r--r-- | sbin/restore/interactive.c | 8 |
3 files changed, 25 insertions, 6 deletions
diff --git a/sbin/mountd/mountd.c b/sbin/mountd/mountd.c index bcd5ca90ca8..5224a41782c 100644 --- a/sbin/mountd/mountd.c +++ b/sbin/mountd/mountd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mountd.c,v 1.17 1997/06/24 20:59:10 deraadt Exp $ */ +/* $OpenBSD: mountd.c,v 1.18 1997/08/06 01:45:21 deraadt Exp $ */ /* $NetBSD: mountd.c,v 1.31 1996/02/18 11:57:53 fvdl Exp $ */ /* @@ -176,6 +176,7 @@ void free_dir __P((struct dirlist *)); void free_exp __P((struct exportlist *)); void free_grp __P((struct grouplist *)); void free_host __P((struct hostlist *)); +void new_exportlist __P((void)); void get_exportlist __P((void)); int get_host __P((char *, struct grouplist *, struct grouplist *)); int get_num __P((char *)); @@ -301,7 +302,7 @@ main(argc, argv) fprintf(pidfile, "%d\n", getpid()); fclose(pidfile); } - signal(SIGHUP, (void (*) __P((int))) get_exportlist); + signal(SIGHUP, (void (*) __P((int))) new_exportlist); signal(SIGTERM, (void (*) __P((int))) send_umntall); if ((udptransp = svcudp_create(RPC_ANYSOCK)) == NULL || (tcptransp = svctcp_create(RPC_ANYSOCK, 0, 0)) == NULL) { @@ -651,6 +652,15 @@ put_exlist(dp, xdrsp, adp, putdefp) char line[LINESIZ]; FILE *exp_file; +void +new_exportlist() +{ + int save_errno = errno; + + get_exportlist(); + errno = save_errno; +} + /* * Get the export list */ diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c index 6eb7aded262..ea7d164f248 100644 --- a/sbin/ping/ping.c +++ b/sbin/ping/ping.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ping.c,v 1.24 1997/06/29 19:23:07 millert Exp $ */ +/* $OpenBSD: ping.c,v 1.25 1997/08/06 01:45:24 deraadt Exp $ */ /* $NetBSD: ping.c,v 1.20 1995/08/11 22:37:58 cgd Exp $ */ /* @@ -47,7 +47,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)ping.c 8.1 (Berkeley) 6/5/93"; #else -static char rcsid[] = "$OpenBSD: ping.c,v 1.24 1997/06/29 19:23:07 millert Exp $"; +static char rcsid[] = "$OpenBSD: ping.c,v 1.25 1997/08/06 01:45:24 deraadt Exp $"; #endif #endif /* not lint */ @@ -512,6 +512,7 @@ void catcher() { int waittime; + int save_errno = errno; pinger(); (void)signal(SIGALRM, catcher); @@ -527,6 +528,7 @@ catcher() (void)signal(SIGALRM, finish); (void)alarm((u_int)waittime); } + errno = save_errno; } /* @@ -535,7 +537,10 @@ catcher() void prtsig() { + int save_errno = errno; + summary(0); + errno = save_errno; } /* diff --git a/sbin/restore/interactive.c b/sbin/restore/interactive.c index 43b49a11699..80aace5fc74 100644 --- a/sbin/restore/interactive.c +++ b/sbin/restore/interactive.c @@ -1,4 +1,4 @@ -/* $OpenBSD: interactive.c,v 1.4 1997/07/05 20:51:22 millert Exp $ */ +/* $OpenBSD: interactive.c,v 1.5 1997/08/06 01:45:26 deraadt Exp $ */ /* $NetBSD: interactive.c,v 1.10 1997/03/19 08:42:52 lukem Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)interactive.c 8.3 (Berkeley) 9/13/94"; #else -static char rcsid[] = "$OpenBSD: interactive.c,v 1.4 1997/07/05 20:51:22 millert Exp $"; +static char rcsid[] = "$OpenBSD: interactive.c,v 1.5 1997/08/06 01:45:26 deraadt Exp $"; #endif #endif /* not lint */ @@ -54,6 +54,7 @@ static char rcsid[] = "$OpenBSD: interactive.c,v 1.4 1997/07/05 20:51:22 millert #include <setjmp.h> #include <glob.h> #include <stdio.h> +#include <errno.h> #include <stdlib.h> #include <string.h> @@ -772,8 +773,11 @@ void onintr(signo) int signo; { + int save_errno = errno; + if (command == 'i' && runshell) longjmp(reset, 1); if (reply("restore interrupted, continue") == FAIL) exit(1); + errno = save_errno; } |