View | Details | Raw Unified | Return to bug 839 | Differences between
and this patch

Collapse All | Expand All

(-)auth-pam.c (-2 / +9 lines)
Lines 93-102 static mysig_t sshpam_oldsig; Link Here
93
static void 
93
static void 
94
sshpam_sigchld_handler(int sig)
94
sshpam_sigchld_handler(int sig)
95
{
95
{
96
	signal(SIGCHLD, SIG_DFL);
96
	if (cleanup_ctxt == NULL)
97
	if (cleanup_ctxt == NULL)
97
		return;	/* handler called after PAM cleanup, shouldn't happen */
98
		return;	/* handler called after PAM cleanup, shouldn't happen */
98
	if (waitpid(cleanup_ctxt->pam_thread, &sshpam_thread_status, 0) == -1)
99
	if (waitpid(cleanup_ctxt->pam_thread, &sshpam_thread_status, WNOHANG)
99
		return;	/* couldn't wait for process */
100
	     == -1) {
101
		/* PAM thread has not exitted, privsep slave must have */
102
		kill(cleanup_ctxt->pam_thread, SIGTERM);
103
		if (waitpid(cleanup_ctxt->pam_thread, &sshpam_thread_status, 0)
104
		    == -1)
105
			return; /* could not wait */
106
	}
100
	if (WIFSIGNALED(sshpam_thread_status) &&
107
	if (WIFSIGNALED(sshpam_thread_status) &&
101
	    WTERMSIG(sshpam_thread_status) == SIGTERM)
108
	    WTERMSIG(sshpam_thread_status) == SIGTERM)
102
		return;	/* terminated by pthread_cancel */
109
		return;	/* terminated by pthread_cancel */

Return to bug 839