summaryrefslogtreecommitdiffstats
path: root/lib/maxfd.c
diff options
context:
space:
mode:
authorLorenz Kästle <lorenz.kaestle@netways.de>2024-10-17 15:57:50 (GMT)
committerLorenz Kästle <lorenz.kaestle@netways.de>2024-10-17 15:57:50 (GMT)
commitee1ba3209993b72e90f5fe30a16ad951f1e2402d (patch)
tree24b9cb0130f89892ea71562f09197d95c269048c /lib/maxfd.c
parent7fb58ce783285a983964d219fff18eba9b12e1e4 (diff)
downloadmonitoring-plugins-ee1ba3209993b72e90f5fe30a16ad951f1e2402d.tar.gz
lib: clang-format
Diffstat (limited to 'lib/maxfd.c')
-rw-r--r--lib/maxfd.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/maxfd.c b/lib/maxfd.c
index 529b356..c39d427 100644
--- a/lib/maxfd.c
+++ b/lib/maxfd.c
@@ -1,7 +1,7 @@
1#include "./maxfd.h" 1#include "./maxfd.h"
2#include <errno.h> 2#include <errno.h>
3 3
4long mp_open_max (void) { 4long mp_open_max(void) {
5 long maxfd = 0L; 5 long maxfd = 0L;
6 /* Try sysconf(_SC_OPEN_MAX) first, as it can be higher than OPEN_MAX. 6 /* Try sysconf(_SC_OPEN_MAX) first, as it can be higher than OPEN_MAX.
7 * If that fails and the macro isn't defined, we fall back to an educated 7 * If that fails and the macro isn't defined, we fall back to an educated
@@ -10,17 +10,17 @@ long mp_open_max (void) {
10 10
11#ifdef _SC_OPEN_MAX 11#ifdef _SC_OPEN_MAX
12 errno = 0; 12 errno = 0;
13 if ((maxfd = sysconf (_SC_OPEN_MAX)) < 0) { 13 if ((maxfd = sysconf(_SC_OPEN_MAX)) < 0) {
14 if (errno == 0) 14 if (errno == 0)
15 maxfd = DEFAULT_MAXFD; /* it's indeterminate */ 15 maxfd = DEFAULT_MAXFD; /* it's indeterminate */
16 else 16 else
17 die (STATE_UNKNOWN, _("sysconf error for _SC_OPEN_MAX\n")); 17 die(STATE_UNKNOWN, _("sysconf error for _SC_OPEN_MAX\n"));
18 } 18 }
19#elif defined(OPEN_MAX) 19#elif defined(OPEN_MAX)
20 return OPEN_MAX 20 return OPEN_MAX
21#else /* sysconf macro unavailable, so guess (may be wildly inaccurate) */ 21#else /* sysconf macro unavailable, so guess (may be wildly inaccurate) */
22 return DEFAULT_MAXFD; 22 return DEFAULT_MAXFD;
23#endif 23#endif
24 24
25 return(maxfd); 25 return (maxfd);
26} 26}