projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'collectd-4.5' into collectd-4.6
[collectd.git]
/
src
/
exec.c
diff --git
a/src/exec.c
b/src/exec.c
index
973cd52
..
ea31b30
100644
(file)
--- a/
src/exec.c
+++ b/
src/exec.c
@@
-1,6
+1,8
@@
/**
* collectd - src/exec.c
/**
* collectd - src/exec.c
- * Copyright (C) 2007,2008 Florian octo Forster
+ * Copyright (C) 2007-2009 Florian octo Forster
+ * Copyright (C) 2007-2009 Sebastian Harl
+ * Copyright (C) 2008 Peter Holik
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@
-17,6
+19,8
@@
*
* Authors:
* Florian octo Forster <octo at verplant.org>
*
* Authors:
* Florian octo Forster <octo at verplant.org>
+ * Sebastian Harl <sh at tokkee.org>
+ * Peter Holik <peter at holik.at>
**/
#include "collectd.h"
**/
#include "collectd.h"
@@
-585,7
+589,17
@@
static void *exec_read_one (void *arg) /* {{{ */
if (errno == EAGAIN || errno == EINTR) continue;
break;
}
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';
pbuffer_err[len] = '\0';
@@
-615,6
+629,7
@@
static void *exec_read_one (void *arg) /* {{{ */
copy = fdset;
}
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;
if (waitpid (pl->pid, &status, 0) > 0)
pl->status = status;
@@
-628,7
+643,8
@@
static void *exec_read_one (void *arg) /* {{{ */
pthread_mutex_unlock (&pl_lock);
close (fd);
pthread_mutex_unlock (&pl_lock);
close (fd);
- close (fd_err);
+ if (fd_err >= 0)
+ close (fd_err);
pthread_exit ((void *) 0);
return (NULL);
pthread_exit ((void *) 0);
return (NULL);