diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2001-09-04 23:36:00 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2001-09-04 23:36:00 +0000 |
commit | 6e69b2a3e9a34411460d33a432a805b3eb1924d1 (patch) | |
tree | 33cfe52f5da9645a00ca15af49ceefdd612696d2 /lib/libc/stdlib | |
parent | 102264589c8731b5f0fb00b204e5963726ecec83 (diff) |
Replace the deprecated BSD sigsetmask/sigblock/sigpause functions with their POSIX counterparts.
Diffstat (limited to 'lib/libc/stdlib')
-rw-r--r-- | lib/libc/stdlib/system.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/libc/stdlib/system.c b/lib/libc/stdlib/system.c index 3e1b047393f..dadf3fe8419 100644 --- a/lib/libc/stdlib/system.c +++ b/lib/libc/stdlib/system.c @@ -32,7 +32,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: system.c,v 1.3 1996/09/15 09:31:52 tholo Exp $"; +static char *rcsid = "$OpenBSD: system.c,v 1.4 2001/09/04 23:35:58 millert Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/types.h> @@ -50,7 +50,7 @@ system(command) { pid_t pid; sig_t intsave, quitsave; - int omask; + sigset_t mask, omask; int pstat; char *argp[] = {"sh", "-c", NULL, NULL}; @@ -59,13 +59,15 @@ system(command) argp[2] = (char *)command; - omask = sigblock(sigmask(SIGCHLD)); + sigemptyset(&mask); + sigaddset(&mask, SIGCHLD); + sigprocmask(SIG_BLOCK, &mask, &omask); switch(pid = vfork()) { case -1: /* error */ - (void)sigsetmask(omask); + sigprocmask(SIG_SETMASK, &omask, NULL); return(-1); case 0: /* child */ - (void)sigsetmask(omask); + sigprocmask(SIG_SETMASK, &omask, NULL); execve(_PATH_BSHELL, argp, environ); _exit(127); } @@ -73,7 +75,7 @@ system(command) intsave = signal(SIGINT, SIG_IGN); quitsave = signal(SIGQUIT, SIG_IGN); pid = waitpid(pid, (int *)&pstat, 0); - (void)sigsetmask(omask); + sigprocmask(SIG_SETMASK, &omask, NULL); (void)signal(SIGINT, intsave); (void)signal(SIGQUIT, quitsave); return(pid == -1 ? -1 : pstat); |