summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f991765)
raw | patch | inline | side by side (parent: f991765)
author | Florian Forster <octo@collectd.org> | |
Wed, 12 Sep 2012 16:25:20 +0000 (18:25 +0200) | ||
committer | Florian Forster <octo@collectd.org> | |
Wed, 12 Sep 2012 16:26:22 +0000 (18:26 +0200) |
select(2) is actually using a variable called "copy", which we didn't set in
this case.
Fixes Github issue #12. Thanks to Tetsuya Kawaguchi for reporting this problem.
this case.
Fixes Github issue #12. Thanks to Tetsuya Kawaguchi for reporting this problem.
src/exec.c | patch | blob | history |
diff --git a/src/exec.c b/src/exec.c
index dd295e98a323cd806f1072ad814e7bb47af8fee3..5274797732aafe945c40264dcfeaa3bbe4f44741 100644 (file)
--- a/src/exec.c
+++ b/src/exec.c
if (len < 0)
{
- if (errno == EAGAIN || errno == EINTR) continue;
+ if (errno == EAGAIN || errno == EINTR)
+ continue;
break;
}
else if (len == 0)
{
/* We've reached EOF */
- NOTICE ("exec plugin: Program `%s' has closed STDERR.",
- pl->exec);
- close (fd_err);
+ NOTICE ("exec plugin: Program `%s' has closed STDERR.", pl->exec);
+
+ /* Remove file descriptor form select() set. */
FD_CLR (fd_err, &fdset);
+ copy = fdset;
highest_fd = fd;
+
+ /* Clean up file descriptor */
+ close (fd_err);
fd_err = -1;
continue;
}