Protect errno in signal handlers, like in portmap.
This commit is contained in:
@@ -32,7 +32,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"$Id$";
|
||||
"$Id: yppasswdd_server.c,v 1.14 1997/10/13 11:18:53 charnier Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -70,6 +70,9 @@ void reaper(sig)
|
||||
extern pid_t pid;
|
||||
extern int pstat;
|
||||
int st;
|
||||
int saved_errno;
|
||||
|
||||
saved_errno = errno;
|
||||
|
||||
if (sig > 0) {
|
||||
if (sig == SIGCHLD)
|
||||
@@ -77,6 +80,8 @@ void reaper(sig)
|
||||
} else {
|
||||
pid = waitpid(pid, &pstat, 0);
|
||||
}
|
||||
|
||||
errno = saved_errno;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"$Id: yp_main.c,v 1.1 1997/11/09 20:54:38 wpaul Exp wpaul $";
|
||||
"$Id: yp_main.c,v 1.17 1998/02/11 19:15:32 wpaul Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@@ -158,13 +158,17 @@ static void unregister()
|
||||
static void reaper(sig)
|
||||
int sig;
|
||||
{
|
||||
int status;
|
||||
int status;
|
||||
int saved_errno;
|
||||
|
||||
saved_errno = errno;
|
||||
|
||||
if (sig == SIGHUP) {
|
||||
load_securenets();
|
||||
#ifdef DB_CACHE
|
||||
yp_flush_all();
|
||||
#endif
|
||||
errno = saved_errno;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -175,6 +179,8 @@ static void reaper(sig)
|
||||
unregister();
|
||||
exit(0);
|
||||
}
|
||||
errno = saved_errno;
|
||||
return;
|
||||
}
|
||||
|
||||
static void usage()
|
||||
|
||||
Reference in New Issue
Block a user