secur32: Reap child process to avoid leaving a zombie.

This commit is contained in:
Ken Thomases 2011-11-30 16:49:27 -06:00 committed by Alexandre Julliard
parent 9979725211
commit 3de1c71364
1 changed files with 15 additions and 2 deletions

View File

@ -28,7 +28,10 @@
#include <sys/types.h>
#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif
#endif
#ifdef HAVE_SYS_ERRNO_H
#include <sys/errno.h>
#endif
#include <stdlib.h>
#include <fcntl.h>
#include "windef.h"
@ -276,7 +279,7 @@ void cleanup_helper(PNegoHelper helper)
{
TRACE("Killing helper %p\n", helper);
if( (helper == NULL) || (helper->helper_pid == 0))
if(helper == NULL)
return;
HeapFree(GetProcessHeap(), 0, helper->com_buf);
@ -285,6 +288,16 @@ void cleanup_helper(PNegoHelper helper)
close(helper->pipe_out);
close(helper->pipe_in);
#ifdef HAVE_FORK
if (helper->helper_pid > 0) /* reap child */
{
pid_t wret;
do {
wret = waitpid(helper->helper_pid, NULL, 0);
} while (wret < 0 && errno == EINTR);
}
#endif
HeapFree(GetProcessHeap(), 0, helper);
}