retry waitpid on EINTR failure
patch from Jakub Jelen on bz#2581; ok dtucker@
This commit is contained in:
parent
da88a70a89
commit
10358abd08
15
auth-pam.c
15
auth-pam.c
|
@ -154,9 +154,12 @@ sshpam_sigchld_handler(int sig)
|
||||||
<= 0) {
|
<= 0) {
|
||||||
/* PAM thread has not exitted, privsep slave must have */
|
/* PAM thread has not exitted, privsep slave must have */
|
||||||
kill(cleanup_ctxt->pam_thread, SIGTERM);
|
kill(cleanup_ctxt->pam_thread, SIGTERM);
|
||||||
if (waitpid(cleanup_ctxt->pam_thread, &sshpam_thread_status, 0)
|
while (waitpid(cleanup_ctxt->pam_thread,
|
||||||
<= 0)
|
&sshpam_thread_status, 0) == -1) {
|
||||||
return; /* could not wait */
|
if (errno == EINTR)
|
||||||
|
continue;
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (WIFSIGNALED(sshpam_thread_status) &&
|
if (WIFSIGNALED(sshpam_thread_status) &&
|
||||||
WTERMSIG(sshpam_thread_status) == SIGTERM)
|
WTERMSIG(sshpam_thread_status) == SIGTERM)
|
||||||
|
@ -217,7 +220,11 @@ pthread_join(sp_pthread_t thread, void **value)
|
||||||
if (sshpam_thread_status != -1)
|
if (sshpam_thread_status != -1)
|
||||||
return (sshpam_thread_status);
|
return (sshpam_thread_status);
|
||||||
signal(SIGCHLD, sshpam_oldsig);
|
signal(SIGCHLD, sshpam_oldsig);
|
||||||
waitpid(thread, &status, 0);
|
while (waitpid(thread, &status, 0) == -1) {
|
||||||
|
if (errno == EINTR)
|
||||||
|
continue;
|
||||||
|
fatal("%s: waitpid: %s", __func__, strerror(errno));
|
||||||
|
}
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue