mirror of
https://github.com/znc/znc.git
synced 2026-06-29 22:41:39 +02:00
Revert rev1504 that introduced an error with modtcl.
Tcl fork()s to create a child process, the child exits and tcl tries to get the child's exit code via waitpid() but when the child process exits, we get SIGCHLD, call waitpid() ourselves and thus the exit code (and the whole zombie) is discarded and tcl can't get the child's exit code. git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1513 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
+6
-1
@@ -556,6 +556,11 @@ int CExecSock::popen2(int & iReadFD, int & iWriteFD, const CString & sCommand) {
|
||||
void CExecSock::close2(int iPid, int iReadFD, int iWriteFD) {
|
||||
close(iReadFD);
|
||||
close(iWriteFD);
|
||||
// If a zombie is left behind, SIGCHLD will handle it
|
||||
u_int iNow = time(NULL);
|
||||
while (waitpid(iPid, NULL, WNOHANG) == 0) {
|
||||
if ((time(NULL) - iNow) > 5)
|
||||
break; // giveup
|
||||
usleep(100);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user