summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: fb2742b)
raw | patch | inline | side by side (parent: fb2742b)
author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Thu, 19 Mar 2009 18:46:01 +0000 (19:46 +0100) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Thu, 19 Mar 2009 18:46:01 +0000 (19:46 +0100) |
When an executed program is closing STDERR but continues running, the
daemon will wait for the child to exit and the child will eventually
block because the pipe is filled up, resulting in no statistics being
collected.
Thanks to Thorsten von Eicken for finding this problem :)
daemon will wait for the child to exit and the child will eventually
block because the pipe is filled up, resulting in no statistics being
collected.
Thanks to Thorsten von Eicken for finding this problem :)
src/exec.c | patch | blob | history |
diff --git a/src/exec.c b/src/exec.c
index a78f902fdef5634b11baaae07045a8ea85578ee5..afce839a058c5d528488e5e00bfcb04e2d4158f7 100644 (file)
--- a/src/exec.c
+++ b/src/exec.c
if (errno == EAGAIN || errno == EINTR) continue;
break;
}
- else if (len == 0) break; /* We've reached EOF */
+ else if (len == 0)
+ {
+ /* We've reached EOF */
+ NOTICE ("exec plugin: Program `%s' has closed STDERR.",
+ pl->exec);
+ close (fd_err);
+ FD_CLR (fd_err, &fdset);
+ highest_fd = fd;
+ fd_err = -1;
+ continue;
+ }
pbuffer_err[len] = '\0';
copy = fdset;
}
+ DEBUG ("exec plugin: exec_read_one: Waiting for `%s' to exit.", pl->exec);
if (waitpid (pl->pid, &status, 0) > 0)
pl->status = status;
pthread_mutex_unlock (&pl_lock);
close (fd);
- close (fd_err);
+ if (fd_err >= 0)
+ close (fd_err);
pthread_exit ((void *) 0);
return (NULL);