diff options
author | Sven Nierlein <sven@nierlein.org> | 2019-02-19 20:42:02 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-19 20:42:02 (GMT) |
commit | 931ed78b5dc062fff33652d87406f1547da5ddbe (patch) | |
tree | 9caf8031a15d7f046e77693c4002bf750bfef3d3 /plugins/common.h | |
parent | 2813d08b92d08ba56ec22da00a23fff3a22ed74b (diff) | |
parent | 7cafb0e84550035fe671662c293122be975065ca (diff) | |
download | monitoring-plugins-931ed78b5dc062fff33652d87406f1547da5ddbe.tar.gz |
Merge pull request #1583 from sni/fix_check_by_ssh_timeout_child_leak
check_by_ssh: fix child process leak on timeouts
Diffstat (limited to 'plugins/common.h')
-rw-r--r-- | plugins/common.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/plugins/common.h b/plugins/common.h index 6bf4fca..0f08e2f 100644 --- a/plugins/common.h +++ b/plugins/common.h | |||
@@ -225,4 +225,18 @@ enum { | |||
225 | # define __attribute__(x) /* do nothing */ | 225 | # define __attribute__(x) /* do nothing */ |
226 | #endif | 226 | #endif |
227 | 227 | ||
228 | /* Try sysconf(_SC_OPEN_MAX) first, as it can be higher than OPEN_MAX. | ||
229 | * If that fails and the macro isn't defined, we fall back to an educated | ||
230 | * guess. There's no guarantee that our guess is adequate and the program | ||
231 | * will die with SIGSEGV if it isn't and the upper boundary is breached. */ | ||
232 | #define DEFAULT_MAXFD 256 /* fallback value if no max open files value is set */ | ||
233 | #define MAXFD_LIMIT 8192 /* upper limit of open files */ | ||
234 | #ifdef _SC_OPEN_MAX | ||
235 | static long maxfd = 0; | ||
236 | #elif defined(OPEN_MAX) | ||
237 | # define maxfd OPEN_MAX | ||
238 | #else /* sysconf macro unavailable, so guess (may be wildly inaccurate) */ | ||
239 | # define maxfd DEFAULT_MAXFD | ||
240 | #endif | ||
241 | |||
228 | #endif /* _COMMON_H_ */ | 242 | #endif /* _COMMON_H_ */ |