summaryrefslogtreecommitdiffstats
path: root/plugins/runcmd.c
diff options
context:
space:
mode:
authorSven Nierlein <sven@nierlein.de>2019-02-15 09:36:28 (GMT)
committerSven Nierlein <sven@nierlein.de>2019-02-15 09:36:28 (GMT)
commit7cafb0e84550035fe671662c293122be975065ca (patch)
tree5d80a8e80854edc41a72da668a89485505d7e5dc /plugins/runcmd.c
parent2962148d8bac3a65f1fb5e1a948e3f0a86a42a1a (diff)
downloadmonitoring-plugins-7cafb0e84550035fe671662c293122be975065ca.tar.gz
check_by_ssh: fix child process leak on timeoutsrefs/pull/1583/head
When check_by_ssh runs into a timeout it simply exits keeping all child processes running. Simply adopting the kill loop from runcmd_timeout_alarm_handler() fixes this. Signed-off-by: Sven Nierlein <sven@nierlein.de>
Diffstat (limited to 'plugins/runcmd.c')
-rw-r--r--plugins/runcmd.c13
1 files changed, 0 insertions, 13 deletions
diff --git a/plugins/runcmd.c b/plugins/runcmd.c
index 1a7c904..c382867 100644
--- a/plugins/runcmd.c
+++ b/plugins/runcmd.c
@@ -67,19 +67,6 @@
67 * occur in any number of threads simultaneously. */ 67 * occur in any number of threads simultaneously. */
68static pid_t *np_pids = NULL; 68static pid_t *np_pids = NULL;
69 69
70/* Try sysconf(_SC_OPEN_MAX) first, as it can be higher than OPEN_MAX.
71 * If that fails and the macro isn't defined, we fall back to an educated
72 * guess. There's no guarantee that our guess is adequate and the program
73 * will die with SIGSEGV if it isn't and the upper boundary is breached. */
74#ifdef _SC_OPEN_MAX
75static long maxfd = 0;
76#elif defined(OPEN_MAX)
77# define maxfd OPEN_MAX
78#else /* sysconf macro unavailable, so guess (may be wildly inaccurate) */
79# define maxfd 256
80#endif
81
82
83/** prototypes **/ 70/** prototypes **/
84static int np_runcmd_open(const char *, int *, int *) 71static int np_runcmd_open(const char *, int *, int *)
85 __attribute__((__nonnull__(1, 2, 3))); 72 __attribute__((__nonnull__(1, 2, 3)));