Fossil SCM

Avoid zombies on client side by waiting for children. This can happen when there are a large number of changes to transmit.

andybradford 2013-08-09 07:23 ssh-shared-account
Commit 308f52a63acf8e1eb74887f0b301d638cb608a2d
1 file changed +2
--- src/popen.c
+++ src/popen.c
@@ -18,10 +18,11 @@
1818
** This file contains an implementation of a bi-directional popen().
1919
*/
2020
#include "config.h"
2121
#include "popen.h"
2222
#include <signal.h>
23
+#include <sys/wait.h>
2324
2425
#ifdef _WIN32
2526
#include <windows.h>
2627
#include <fcntl.h>
2728
/*
@@ -213,7 +214,8 @@
213214
fclose(pOut);
214215
#else
215216
close(fdIn);
216217
fclose(pOut);
217218
kill(childPid, SIGINT);
219
+ while( waitpid(0, 0, WNOHANG)>0 ) {}
218220
#endif
219221
}
220222
--- src/popen.c
+++ src/popen.c
@@ -18,10 +18,11 @@
18 ** This file contains an implementation of a bi-directional popen().
19 */
20 #include "config.h"
21 #include "popen.h"
22 #include <signal.h>
 
23
24 #ifdef _WIN32
25 #include <windows.h>
26 #include <fcntl.h>
27 /*
@@ -213,7 +214,8 @@
213 fclose(pOut);
214 #else
215 close(fdIn);
216 fclose(pOut);
217 kill(childPid, SIGINT);
 
218 #endif
219 }
220
--- src/popen.c
+++ src/popen.c
@@ -18,10 +18,11 @@
18 ** This file contains an implementation of a bi-directional popen().
19 */
20 #include "config.h"
21 #include "popen.h"
22 #include <signal.h>
23 #include <sys/wait.h>
24
25 #ifdef _WIN32
26 #include <windows.h>
27 #include <fcntl.h>
28 /*
@@ -213,7 +214,8 @@
214 fclose(pOut);
215 #else
216 close(fdIn);
217 fclose(pOut);
218 kill(childPid, SIGINT);
219 while( waitpid(0, 0, WNOHANG)>0 ) {}
220 #endif
221 }
222

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button