X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fexec.c;h=5274797732aafe945c40264dcfeaa3bbe4f44741;hb=bba1e9a442fc723a1b83648e40ba07900ffac91d;hp=dd295e98a323cd806f1072ad814e7bb47af8fee3;hpb=5abe911631a15dd312d83db92c9dd9da9f13c9df;p=collectd.git diff --git a/src/exec.c b/src/exec.c index dd295e98..52747977 100644 --- a/src/exec.c +++ b/src/exec.c @@ -637,17 +637,22 @@ static void *exec_read_one (void *arg) /* {{{ */ 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; }