From: Todd C. Miller Date: Tue, 22 Jan 2002 03:37:55 +0000 (+0000) Subject: Use sigaction() not signal() X-Git-Tag: SUDO_1_6_6~13 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=33efe1270f238c818743e1863685dde684c43c72;p=sudo Use sigaction() not signal() --- diff --git a/auth/bsdauth.c b/auth/bsdauth.c index 232bb7ed7..344176045 100644 --- a/auth/bsdauth.c +++ b/auth/bsdauth.c @@ -57,6 +57,7 @@ #endif /* HAVE_UNISTD_H */ #include #include +#include #include #include @@ -114,12 +115,15 @@ bsdauth_verify(pw, prompt, auth) char *s, *pass; size_t len; int authok = 0; - sig_t childkiller; + sigaction_t sa, osa; auth_session_t *as = (auth_session_t *) auth->data; extern int nil_pw; /* save old signal handler */ - childkiller = signal(SIGCHLD, SIG_DFL); + sigemptyset(&sa.sa_mask); + sa.sa_flags = SA_RESTART; + sa.sa_handler = SIG_DFL; + (void) sigaction(SIGCHLD, &sa, &osa); /* * If there is a challenge then print that instead of the normal @@ -160,7 +164,7 @@ bsdauth_verify(pw, prompt, auth) } /* restore old signal handler */ - (void)signal(SIGCHLD, childkiller); + (void) sigaction(SIGCHLD, &osa, NULL); if (authok) return(AUTH_SUCCESS);