diff options
author | 2001-09-04 23:35:57 +0000 | |
---|---|---|
committer | 2001-09-04 23:35:57 +0000 | |
commit | 9a7fa6a3bae31e414517a8c0f42be17b33cbbdde (patch) | |
tree | 000cb82ab8dd6c4281507d04c77945ba5fb9f0d5 /lib/libc/stdlib/system.c | |
parent | Use _waitq_remove() and _waitq_insert() always; from FreeBSD. (diff) | |
download | wireguard-openbsd-9a7fa6a3bae31e414517a8c0f42be17b33cbbdde.tar.xz wireguard-openbsd-9a7fa6a3bae31e414517a8c0f42be17b33cbbdde.zip |
Replace the deprecated BSD sigsetmask/sigblock/sigpause functions with their POSIX counterparts.
Diffstat (limited to 'lib/libc/stdlib/system.c')
-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); |