Matt McCutchen's Web Site
/
rsync
/
rsync.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
191e40d
)
Instead of ignoring SIG_CHLD, reap zombies in the signal handler.
author
Wayne Davison
<wayned@samba.org>
Mon, 4 Aug 2003 18:27:27 +0000
(18:27 +0000)
committer
Wayne Davison
<wayned@samba.org>
Mon, 4 Aug 2003 18:27:27 +0000
(18:27 +0000)
socket.c
patch
|
blob
|
blame
|
history
diff --git
a/socket.c
b/socket.c
index
eb0660b
..
cb15441
100644
(file)
--- a/
socket.c
+++ b/
socket.c
@@
-374,6
+374,14
@@
int is_a_socket(int fd)
}
}
+static RETSIGTYPE sigchld_handler(int UNUSED(val)) {
+ signal(SIGCHLD, sigchld_handler);
+#ifdef WNOHANG
+ while (waitpid(-1, NULL, WNOHANG) > 0) {}
+#endif
+}
+
+
void start_accept_loop(int port, int (*fn)(int, int))
{
int s;
void start_accept_loop(int port, int (*fn)(int, int))
{
int s;
@@
-419,14
+427,7
@@
void start_accept_loop(int port, int (*fn)(int, int))
if (fd == -1) continue;
if (fd == -1) continue;
- signal(SIGCHLD, SIG_IGN);
-
- /* we shouldn't have any children left hanging around
- but I have had reports that on Digital Unix zombies
- are produced, so this ensures that they are reaped */
-#ifdef WNOHANG
- while (waitpid(-1, NULL, WNOHANG) > 0);
-#endif
+ signal(SIGCHLD, sigchld_handler);
if ((pid = fork()) == 0) {
int ret;
if ((pid = fork()) == 0) {
int ret;