diff options
author | Todd C. Miller <Todd.Miller@courtesan.com> | 2001-12-08 19:44:30 +0000 |
---|---|---|
committer | Todd C. Miller <Todd.Miller@courtesan.com> | 2001-12-08 19:44:30 +0000 |
commit | 31693baa7523e41c190333ea89fd96efc3b19272 (patch) | |
tree | 76fdb42925e51f1b1394ef9df90eade4e3eaad81 /sudo.c | |
parent | 9584da982e21b40e86149a0a16a43df685c52bb5 (diff) | |
download | sudo-31693baa7523e41c190333ea89fd96efc3b19272.tar.gz |
Kill POSIX_SIGNALS define and old signal support now that we emulate POSIX ones
Also be sure to correctly initialize struct sigaction.
Diffstat (limited to 'sudo.c')
-rw-r--r-- | sudo.c | 23 |
1 files changed, 3 insertions, 20 deletions
@@ -146,11 +146,7 @@ main(argc, argv, envp) int cmnd_status; int sudo_mode; int pwflag; -#ifdef POSIX_SIGNALS sigset_t set, oset; -#else - int omask; -#endif /* POSIX_SIGNALS */ extern int printmatches; extern char **environ; @@ -177,15 +173,11 @@ main(argc, argv, envp) * Block signals so the user cannot interrupt us at some point and * avoid the logging. */ -#ifdef POSIX_SIGNALS (void) sigemptyset(&set); (void) sigaddset(&set, SIGINT); (void) sigaddset(&set, SIGQUIT); (void) sigaddset(&set, SIGTSTP); (void) sigprocmask(SIG_BLOCK, &set, &oset); -#else - omask = sigblock(sigmask(SIGINT)|sigmask(SIGQUIT)|sigmask(SIGTSTP)); -#endif /* POSIX_SIGNALS */ /* * Setup signal handlers, turn off core dumps, and close open files. @@ -344,11 +336,7 @@ main(argc, argv, envp) endpwent(); /* Reset signal mask before we exec. */ -#ifdef POSIX_SIGNALS (void) sigprocmask(SIG_SETMASK, &oset, NULL); -#else - (void) sigsetmask(omask); -#endif /* POSIX_SIGNALS */ /* Override user's umask if configured to do so. */ if (def_ival(I_UMASK) != 0777) @@ -809,9 +797,7 @@ initial_setup() #ifdef HAVE_SETRLIMIT struct rlimit rl; #endif -#ifdef POSIX_SIGNALS - struct sigaction sa; -#endif + sigaction_t sa; #if defined(RLIMIT_CORE) && !defined(SUDO_DEVEL) /* @@ -841,13 +827,10 @@ initial_setup() (void) close(fd); /* Catch children as they die... */ -#ifdef POSIX_SIGNALS - (void) memset((VOID *)&sa, 0, sizeof(sa)); + sigemptyset(&sa.sa_mask); + sa.sa_flags = SA_RESTART; sa.sa_handler = reapchild; (void) sigaction(SIGCHLD, &sa, NULL); -#else - (void) signal(SIGCHLD, reapchild); -#endif /* POSIX_SIGNALS */ /* Set set_perms pointer to the correct function */ #if defined(_SC_SAVED_IDS) && defined(_SC_VERSION) |