diff options
-rw-r--r-- | lib/tests/test_cmd.c | 38 | ||||
-rw-r--r-- | lib/utils_cmd.c | 21 | ||||
-rw-r--r-- | lib/utils_cmd.h | 12 | ||||
-rw-r--r-- | plugins/check_apt.c | 4 | ||||
-rw-r--r-- | plugins/check_by_ssh.c | 2 | ||||
-rw-r--r-- | plugins/check_dig.c | 2 | ||||
-rw-r--r-- | plugins/check_dns.c | 2 | ||||
-rw-r--r-- | plugins/check_load.c | 2 | ||||
-rw-r--r-- | plugins/check_nagios.c | 2 | ||||
-rw-r--r-- | plugins/check_procs.c | 2 | ||||
-rw-r--r-- | plugins/check_snmp.c | 2 | ||||
-rw-r--r-- | plugins/negate.c | 2 | ||||
-rw-r--r-- | plugins/runcmd.c | 10 | ||||
-rw-r--r-- | plugins/runcmd.h | 2 |
14 files changed, 51 insertions, 52 deletions
diff --git a/lib/tests/test_cmd.c b/lib/tests/test_cmd.c index 29ca42ac..d67c4d57 100644 --- a/lib/tests/test_cmd.c +++ b/lib/tests/test_cmd.c | |||
@@ -40,13 +40,11 @@ get_command (char *const *line) | |||
40 | } | 40 | } |
41 | 41 | ||
42 | int | 42 | int |
43 | main (int argc, char **argv) | 43 | main () |
44 | { | 44 | { |
45 | char **command_line = malloc (sizeof (char *) * COMMAND_LINE); | 45 | char **command_line = malloc (sizeof (char *) * COMMAND_LINE); |
46 | char *command = NULL; | 46 | char *command = NULL; |
47 | char *perl; | 47 | cmd_output chld_out, chld_err; |
48 | output chld_out, chld_err; | ||
49 | int c; | ||
50 | int result = UNSET; | 48 | int result = UNSET; |
51 | 49 | ||
52 | plan_tests(51); | 50 | plan_tests(51); |
@@ -54,8 +52,8 @@ main (int argc, char **argv) | |||
54 | diag ("Running plain echo command, set one"); | 52 | diag ("Running plain echo command, set one"); |
55 | 53 | ||
56 | /* ensure everything is empty before we begin */ | 54 | /* ensure everything is empty before we begin */ |
57 | memset (&chld_out, 0, sizeof (output)); | 55 | memset (&chld_out, 0, sizeof (cmd_output)); |
58 | memset (&chld_err, 0, sizeof (output)); | 56 | memset (&chld_err, 0, sizeof (cmd_output)); |
59 | ok (chld_out.lines == 0, "(initialised) Checking stdout is reset"); | 57 | ok (chld_out.lines == 0, "(initialised) Checking stdout is reset"); |
60 | ok (chld_err.lines == 0, "(initialised) Checking stderr is reset"); | 58 | ok (chld_err.lines == 0, "(initialised) Checking stderr is reset"); |
61 | ok (result == UNSET, "(initialised) Checking exit code is reset"); | 59 | ok (result == UNSET, "(initialised) Checking exit code is reset"); |
@@ -78,8 +76,8 @@ main (int argc, char **argv) | |||
78 | ok (result == 0, "(array) Checking exit code"); | 76 | ok (result == 0, "(array) Checking exit code"); |
79 | 77 | ||
80 | /* ensure everything is empty again */ | 78 | /* ensure everything is empty again */ |
81 | memset (&chld_out, 0, sizeof (output)); | 79 | memset (&chld_out, 0, sizeof (cmd_output)); |
82 | memset (&chld_err, 0, sizeof (output)); | 80 | memset (&chld_err, 0, sizeof (cmd_output)); |
83 | result = UNSET; | 81 | result = UNSET; |
84 | ok (chld_out.lines == 0, "(initialised) Checking stdout is reset"); | 82 | ok (chld_out.lines == 0, "(initialised) Checking stdout is reset"); |
85 | ok (chld_err.lines == 0, "(initialised) Checking stderr is reset"); | 83 | ok (chld_err.lines == 0, "(initialised) Checking stderr is reset"); |
@@ -98,8 +96,8 @@ main (int argc, char **argv) | |||
98 | diag ("Running plain echo command, set two"); | 96 | diag ("Running plain echo command, set two"); |
99 | 97 | ||
100 | /* ensure everything is empty again */ | 98 | /* ensure everything is empty again */ |
101 | memset (&chld_out, 0, sizeof (output)); | 99 | memset (&chld_out, 0, sizeof (cmd_output)); |
102 | memset (&chld_err, 0, sizeof (output)); | 100 | memset (&chld_err, 0, sizeof (cmd_output)); |
103 | result = UNSET; | 101 | result = UNSET; |
104 | ok (chld_out.lines == 0, "(initialised) Checking stdout is reset"); | 102 | ok (chld_out.lines == 0, "(initialised) Checking stdout is reset"); |
105 | ok (chld_err.lines == 0, "(initialised) Checking stderr is reset"); | 103 | ok (chld_err.lines == 0, "(initialised) Checking stderr is reset"); |
@@ -121,8 +119,8 @@ main (int argc, char **argv) | |||
121 | ok (result == 0, "(array) Checking exit code"); | 119 | ok (result == 0, "(array) Checking exit code"); |
122 | 120 | ||
123 | /* ensure everything is empty again */ | 121 | /* ensure everything is empty again */ |
124 | memset (&chld_out, 0, sizeof (output)); | 122 | memset (&chld_out, 0, sizeof (cmd_output)); |
125 | memset (&chld_err, 0, sizeof (output)); | 123 | memset (&chld_err, 0, sizeof (cmd_output)); |
126 | result = UNSET; | 124 | result = UNSET; |
127 | ok (chld_out.lines == 0, "(initialised) Checking stdout is reset"); | 125 | ok (chld_out.lines == 0, "(initialised) Checking stdout is reset"); |
128 | ok (chld_err.lines == 0, "(initialised) Checking stderr is reset"); | 126 | ok (chld_err.lines == 0, "(initialised) Checking stderr is reset"); |
@@ -140,8 +138,8 @@ main (int argc, char **argv) | |||
140 | 138 | ||
141 | 139 | ||
142 | /* ensure everything is empty again */ | 140 | /* ensure everything is empty again */ |
143 | memset (&chld_out, 0, sizeof (output)); | 141 | memset (&chld_out, 0, sizeof (cmd_output)); |
144 | memset (&chld_err, 0, sizeof (output)); | 142 | memset (&chld_err, 0, sizeof (cmd_output)); |
145 | result = UNSET; | 143 | result = UNSET; |
146 | ok (chld_out.lines == 0, "(initialised) Checking stdout is reset"); | 144 | ok (chld_out.lines == 0, "(initialised) Checking stdout is reset"); |
147 | ok (chld_err.lines == 0, "(initialised) Checking stderr is reset"); | 145 | ok (chld_err.lines == 0, "(initialised) Checking stderr is reset"); |
@@ -168,8 +166,8 @@ main (int argc, char **argv) | |||
168 | 166 | ||
169 | 167 | ||
170 | /* ensure everything is empty again */ | 168 | /* ensure everything is empty again */ |
171 | memset (&chld_out, 0, sizeof (output)); | 169 | memset (&chld_out, 0, sizeof (cmd_output)); |
172 | memset (&chld_err, 0, sizeof (output)); | 170 | memset (&chld_err, 0, sizeof (cmd_output)); |
173 | result = UNSET; | 171 | result = UNSET; |
174 | ok (chld_out.lines == 0, "(initialised) Checking stdout is reset"); | 172 | ok (chld_out.lines == 0, "(initialised) Checking stdout is reset"); |
175 | ok (chld_err.lines == 0, "(initialised) Checking stderr is reset"); | 173 | ok (chld_err.lines == 0, "(initialised) Checking stderr is reset"); |
@@ -187,8 +185,8 @@ main (int argc, char **argv) | |||
187 | 185 | ||
188 | 186 | ||
189 | /* ensure everything is empty again */ | 187 | /* ensure everything is empty again */ |
190 | memset (&chld_out, 0, sizeof (output)); | 188 | memset (&chld_out, 0, sizeof (cmd_output)); |
191 | memset (&chld_err, 0, sizeof (output)); | 189 | memset (&chld_err, 0, sizeof (cmd_output)); |
192 | result = UNSET; | 190 | result = UNSET; |
193 | 191 | ||
194 | command = (char *)malloc(COMMAND_LINE); | 192 | command = (char *)malloc(COMMAND_LINE); |
@@ -214,8 +212,8 @@ main (int argc, char **argv) | |||
214 | 212 | ||
215 | 213 | ||
216 | /* ensure everything is empty again */ | 214 | /* ensure everything is empty again */ |
217 | memset (&chld_out, 0, sizeof (output)); | 215 | memset (&chld_out, 0, sizeof (cmd_output)); |
218 | memset (&chld_err, 0, sizeof (output)); | 216 | memset (&chld_err, 0, sizeof (cmd_output)); |
219 | result = UNSET; | 217 | result = UNSET; |
220 | 218 | ||
221 | command = (char *)malloc(COMMAND_LINE); | 219 | command = (char *)malloc(COMMAND_LINE); |
diff --git a/lib/utils_cmd.c b/lib/utils_cmd.c index 795840d3..2dc5deb0 100644 --- a/lib/utils_cmd.c +++ b/lib/utils_cmd.c | |||
@@ -70,7 +70,7 @@ extern char **environ; | |||
70 | static int _cmd_open (char *const *, int *, int *) | 70 | static int _cmd_open (char *const *, int *, int *) |
71 | __attribute__ ((__nonnull__ (1, 2, 3))); | 71 | __attribute__ ((__nonnull__ (1, 2, 3))); |
72 | 72 | ||
73 | static int _cmd_fetch_output (int, output *, int) | 73 | static int _cmd_fetch_output (int, cmd_output *, int) |
74 | __attribute__ ((__nonnull__ (2))); | 74 | __attribute__ ((__nonnull__ (2))); |
75 | 75 | ||
76 | static int _cmd_close (int); | 76 | static int _cmd_close (int); |
@@ -196,7 +196,7 @@ _cmd_close (int fd) | |||
196 | 196 | ||
197 | 197 | ||
198 | static int | 198 | static int |
199 | _cmd_fetch_output (int fd, output * op, int flags) | 199 | _cmd_fetch_output (int fd, cmd_output * op, int flags) |
200 | { | 200 | { |
201 | size_t len = 0, i = 0, lineno = 0; | 201 | size_t len = 0, i = 0, lineno = 0; |
202 | size_t rsf = 6, ary_size = 0; /* rsf = right shift factor, dec'ed uncond once */ | 202 | size_t rsf = 6, ary_size = 0; /* rsf = right shift factor, dec'ed uncond once */ |
@@ -267,9 +267,8 @@ _cmd_fetch_output (int fd, output * op, int flags) | |||
267 | 267 | ||
268 | 268 | ||
269 | int | 269 | int |
270 | cmd_run (const char *cmdstring, output * out, output * err, int flags) | 270 | cmd_run (const char *cmdstring, cmd_output * out, cmd_output * err, int flags) |
271 | { | 271 | { |
272 | int fd, pfd_out[2], pfd_err[2]; | ||
273 | int i = 0, argc; | 272 | int i = 0, argc; |
274 | size_t cmdlen; | 273 | size_t cmdlen; |
275 | char **argv = NULL; | 274 | char **argv = NULL; |
@@ -281,9 +280,9 @@ cmd_run (const char *cmdstring, output * out, output * err, int flags) | |||
281 | 280 | ||
282 | /* initialize the structs */ | 281 | /* initialize the structs */ |
283 | if (out) | 282 | if (out) |
284 | memset (out, 0, sizeof (output)); | 283 | memset (out, 0, sizeof (cmd_output)); |
285 | if (err) | 284 | if (err) |
286 | memset (err, 0, sizeof (output)); | 285 | memset (err, 0, sizeof (cmd_output)); |
287 | 286 | ||
288 | /* make copy of command string so strtok() doesn't silently modify it */ | 287 | /* make copy of command string so strtok() doesn't silently modify it */ |
289 | /* (the calling program may want to access it later) */ | 288 | /* (the calling program may want to access it later) */ |
@@ -342,15 +341,15 @@ cmd_run (const char *cmdstring, output * out, output * err, int flags) | |||
342 | } | 341 | } |
343 | 342 | ||
344 | int | 343 | int |
345 | cmd_run_array (char *const *argv, output * out, output * err, int flags) | 344 | cmd_run_array (char *const *argv, cmd_output * out, cmd_output * err, int flags) |
346 | { | 345 | { |
347 | int fd, pfd_out[2], pfd_err[2]; | 346 | int fd, pfd_out[2], pfd_err[2]; |
348 | 347 | ||
349 | /* initialize the structs */ | 348 | /* initialize the structs */ |
350 | if (out) | 349 | if (out) |
351 | memset (out, 0, sizeof (output)); | 350 | memset (out, 0, sizeof (cmd_output)); |
352 | if (err) | 351 | if (err) |
353 | memset (err, 0, sizeof (output)); | 352 | memset (err, 0, sizeof (cmd_output)); |
354 | 353 | ||
355 | if ((fd = _cmd_open (argv, pfd_out, pfd_err)) == -1) | 354 | if ((fd = _cmd_open (argv, pfd_out, pfd_err)) == -1) |
356 | die (STATE_UNKNOWN, _("Could not open pipe: %s\n"), argv[0]); | 355 | die (STATE_UNKNOWN, _("Could not open pipe: %s\n"), argv[0]); |
@@ -364,11 +363,11 @@ cmd_run_array (char *const *argv, output * out, output * err, int flags) | |||
364 | } | 363 | } |
365 | 364 | ||
366 | int | 365 | int |
367 | cmd_file_read ( char *filename, output *out, int flags) | 366 | cmd_file_read ( char *filename, cmd_output *out, int flags) |
368 | { | 367 | { |
369 | int fd; | 368 | int fd; |
370 | if(out) | 369 | if(out) |
371 | memset (out, 0, sizeof(output)); | 370 | memset (out, 0, sizeof(cmd_output)); |
372 | 371 | ||
373 | if ((fd = open(filename, O_RDONLY)) == -1) { | 372 | if ((fd = open(filename, O_RDONLY)) == -1) { |
374 | die( STATE_UNKNOWN, _("Error opening %s: %s"), filename, strerror(errno) ); | 373 | die( STATE_UNKNOWN, _("Error opening %s: %s"), filename, strerror(errno) ); |
diff --git a/lib/utils_cmd.h b/lib/utils_cmd.h index 6f3aeb81..b37c7712 100644 --- a/lib/utils_cmd.h +++ b/lib/utils_cmd.h | |||
@@ -7,8 +7,10 @@ | |||
7 | * | 7 | * |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <sys/types.h> | ||
11 | |||
10 | /** types **/ | 12 | /** types **/ |
11 | struct output | 13 | struct cmd_output |
12 | { | 14 | { |
13 | char *buf; /* output buffer */ | 15 | char *buf; /* output buffer */ |
14 | size_t buflen; /* output buffer content length */ | 16 | size_t buflen; /* output buffer content length */ |
@@ -17,12 +19,12 @@ struct output | |||
17 | size_t lines; /* lines of output */ | 19 | size_t lines; /* lines of output */ |
18 | }; | 20 | }; |
19 | 21 | ||
20 | typedef struct output output; | 22 | typedef struct cmd_output cmd_output; |
21 | 23 | ||
22 | /** prototypes **/ | 24 | /** prototypes **/ |
23 | int cmd_run (const char *, output *, output *, int); | 25 | int cmd_run (const char *, cmd_output *, cmd_output *, int); |
24 | int cmd_run_array (char *const *, output *, output *, int); | 26 | int cmd_run_array (char *const *, cmd_output *, cmd_output *, int); |
25 | int cmd_file_read (char *, output *, int); | 27 | int cmd_file_read (char *, cmd_output *, int); |
26 | 28 | ||
27 | /* only multi-threaded plugins need to bother with this */ | 29 | /* only multi-threaded plugins need to bother with this */ |
28 | void cmd_init (void); | 30 | void cmd_init (void); |
diff --git a/plugins/check_apt.c b/plugins/check_apt.c index 312909b7..d41e2a6c 100644 --- a/plugins/check_apt.c +++ b/plugins/check_apt.c | |||
@@ -252,7 +252,7 @@ int process_arguments (int argc, char **argv) { | |||
252 | /* run an apt-get upgrade */ | 252 | /* run an apt-get upgrade */ |
253 | int run_upgrade(int *pkgcount, int *secpkgcount, char ***pkglist, char ***secpkglist){ | 253 | int run_upgrade(int *pkgcount, int *secpkgcount, char ***pkglist, char ***secpkglist){ |
254 | int i=0, result=STATE_UNKNOWN, regres=0, pc=0, spc=0; | 254 | int i=0, result=STATE_UNKNOWN, regres=0, pc=0, spc=0; |
255 | struct output chld_out, chld_err; | 255 | struct cmd_output chld_out, chld_err; |
256 | regex_t ireg, ereg, sreg; | 256 | regex_t ireg, ereg, sreg; |
257 | char *cmdline=NULL, rerrbuf[64]; | 257 | char *cmdline=NULL, rerrbuf[64]; |
258 | 258 | ||
@@ -368,7 +368,7 @@ int run_upgrade(int *pkgcount, int *secpkgcount, char ***pkglist, char ***secpkg | |||
368 | /* run an apt-get update (needs root) */ | 368 | /* run an apt-get update (needs root) */ |
369 | int run_update(void){ | 369 | int run_update(void){ |
370 | int i=0, result=STATE_UNKNOWN; | 370 | int i=0, result=STATE_UNKNOWN; |
371 | struct output chld_out, chld_err; | 371 | struct cmd_output chld_out, chld_err; |
372 | char *cmdline; | 372 | char *cmdline; |
373 | 373 | ||
374 | /* run the update */ | 374 | /* run the update */ |
diff --git a/plugins/check_by_ssh.c b/plugins/check_by_ssh.c index 1ad547ed..4ea721b2 100644 --- a/plugins/check_by_ssh.c +++ b/plugins/check_by_ssh.c | |||
@@ -71,7 +71,7 @@ main (int argc, char **argv) | |||
71 | int i; | 71 | int i; |
72 | time_t local_time; | 72 | time_t local_time; |
73 | FILE *fp = NULL; | 73 | FILE *fp = NULL; |
74 | output chld_out, chld_err; | 74 | cmd_output chld_out, chld_err; |
75 | 75 | ||
76 | remotecmd = ""; | 76 | remotecmd = ""; |
77 | comm_append(SSH_COMMAND); | 77 | comm_append(SSH_COMMAND); |
diff --git a/plugins/check_dig.c b/plugins/check_dig.c index 5d85ae26..2b8b04dc 100644 --- a/plugins/check_dig.c +++ b/plugins/check_dig.c | |||
@@ -67,7 +67,7 @@ int | |||
67 | main (int argc, char **argv) | 67 | main (int argc, char **argv) |
68 | { | 68 | { |
69 | char *command_line; | 69 | char *command_line; |
70 | output chld_out, chld_err; | 70 | cmd_output chld_out, chld_err; |
71 | char *msg = NULL; | 71 | char *msg = NULL; |
72 | size_t i; | 72 | size_t i; |
73 | char *t; | 73 | char *t; |
diff --git a/plugins/check_dns.c b/plugins/check_dns.c index 9de6caf5..167dc4f4 100644 --- a/plugins/check_dns.c +++ b/plugins/check_dns.c | |||
@@ -86,7 +86,7 @@ main (int argc, char **argv) | |||
86 | long microsec; | 86 | long microsec; |
87 | struct timeval tv; | 87 | struct timeval tv; |
88 | int parse_address = FALSE; /* This flag scans for Address: but only after Name: */ | 88 | int parse_address = FALSE; /* This flag scans for Address: but only after Name: */ |
89 | output chld_out, chld_err; | 89 | cmd_output chld_out, chld_err; |
90 | size_t i; | 90 | size_t i; |
91 | int is_nxdomain = FALSE; | 91 | int is_nxdomain = FALSE; |
92 | 92 | ||
diff --git a/plugins/check_load.c b/plugins/check_load.c index 00f7c877..388714f2 100644 --- a/plugins/check_load.c +++ b/plugins/check_load.c | |||
@@ -396,7 +396,7 @@ int cmpstringp(const void *p1, const void *p2) { | |||
396 | 396 | ||
397 | static int print_top_consuming_processes() { | 397 | static int print_top_consuming_processes() { |
398 | int i = 0; | 398 | int i = 0; |
399 | struct output chld_out, chld_err; | 399 | struct cmd_output chld_out, chld_err; |
400 | if(np_runcmd(PS_COMMAND, &chld_out, &chld_err, 0) != 0){ | 400 | if(np_runcmd(PS_COMMAND, &chld_out, &chld_err, 0) != 0){ |
401 | fprintf(stderr, _("'%s' exited with non-zero status.\n"), PS_COMMAND); | 401 | fprintf(stderr, _("'%s' exited with non-zero status.\n"), PS_COMMAND); |
402 | return STATE_UNKNOWN; | 402 | return STATE_UNKNOWN; |
diff --git a/plugins/check_nagios.c b/plugins/check_nagios.c index 40d68f03..d58a2d57 100644 --- a/plugins/check_nagios.c +++ b/plugins/check_nagios.c | |||
@@ -77,7 +77,7 @@ main (int argc, char **argv) | |||
77 | int expected_cols = PS_COLS - 1; | 77 | int expected_cols = PS_COLS - 1; |
78 | const char *zombie = "Z"; | 78 | const char *zombie = "Z"; |
79 | char *temp_string; | 79 | char *temp_string; |
80 | output chld_out, chld_err; | 80 | cmd_output chld_out, chld_err; |
81 | size_t i; | 81 | size_t i; |
82 | 82 | ||
83 | setlocale (LC_ALL, ""); | 83 | setlocale (LC_ALL, ""); |
diff --git a/plugins/check_procs.c b/plugins/check_procs.c index a025ee89..931d3dc0 100644 --- a/plugins/check_procs.c +++ b/plugins/check_procs.c | |||
@@ -152,7 +152,7 @@ main (int argc, char **argv) | |||
152 | int i = 0, j = 0; | 152 | int i = 0, j = 0; |
153 | int result = STATE_UNKNOWN; | 153 | int result = STATE_UNKNOWN; |
154 | int ret = 0; | 154 | int ret = 0; |
155 | output chld_out, chld_err; | 155 | cmd_output chld_out, chld_err; |
156 | 156 | ||
157 | setlocale (LC_ALL, ""); | 157 | setlocale (LC_ALL, ""); |
158 | bindtextdomain (PACKAGE, LOCALEDIR); | 158 | bindtextdomain (PACKAGE, LOCALEDIR); |
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c index 56bad880..67aa6be1 100644 --- a/plugins/check_snmp.c +++ b/plugins/check_snmp.c | |||
@@ -199,7 +199,7 @@ main (int argc, char **argv) | |||
199 | char *th_warn=NULL; | 199 | char *th_warn=NULL; |
200 | char *th_crit=NULL; | 200 | char *th_crit=NULL; |
201 | char type[8] = ""; | 201 | char type[8] = ""; |
202 | output chld_out, chld_err; | 202 | struct cmd_output chld_out, chld_err; |
203 | char *previous_string=NULL; | 203 | char *previous_string=NULL; |
204 | char *ap=NULL; | 204 | char *ap=NULL; |
205 | char *state_string=NULL; | 205 | char *state_string=NULL; |
diff --git a/plugins/negate.c b/plugins/negate.c index 50f62d33..f3d0c376 100644 --- a/plugins/negate.c +++ b/plugins/negate.c | |||
@@ -62,7 +62,7 @@ main (int argc, char **argv) | |||
62 | int result = STATE_UNKNOWN; | 62 | int result = STATE_UNKNOWN; |
63 | char *sub; | 63 | char *sub; |
64 | char **command_line; | 64 | char **command_line; |
65 | output chld_out, chld_err; | 65 | cmd_output chld_out, chld_err; |
66 | int i; | 66 | int i; |
67 | 67 | ||
68 | setlocale (LC_ALL, ""); | 68 | setlocale (LC_ALL, ""); |
diff --git a/plugins/runcmd.c b/plugins/runcmd.c index a7155d27..8919a9fb 100644 --- a/plugins/runcmd.c +++ b/plugins/runcmd.c | |||
@@ -71,7 +71,7 @@ static pid_t *np_pids = NULL; | |||
71 | static int np_runcmd_open(const char *, int *, int *) | 71 | static int np_runcmd_open(const char *, int *, int *) |
72 | __attribute__((__nonnull__(1, 2, 3))); | 72 | __attribute__((__nonnull__(1, 2, 3))); |
73 | 73 | ||
74 | static int np_fetch_output(int, output *, int) | 74 | static int np_fetch_output(int, cmd_output *, int) |
75 | __attribute__((__nonnull__(2))); | 75 | __attribute__((__nonnull__(2))); |
76 | 76 | ||
77 | static int np_runcmd_close(int); | 77 | static int np_runcmd_close(int); |
@@ -253,7 +253,7 @@ runcmd_timeout_alarm_handler (int signo) | |||
253 | 253 | ||
254 | 254 | ||
255 | static int | 255 | static int |
256 | np_fetch_output(int fd, output *op, int flags) | 256 | np_fetch_output(int fd, cmd_output *op, int flags) |
257 | { | 257 | { |
258 | size_t len = 0, i = 0, lineno = 0; | 258 | size_t len = 0, i = 0, lineno = 0; |
259 | size_t rsf = 6, ary_size = 0; /* rsf = right shift factor, dec'ed uncond once */ | 259 | size_t rsf = 6, ary_size = 0; /* rsf = right shift factor, dec'ed uncond once */ |
@@ -322,13 +322,13 @@ np_fetch_output(int fd, output *op, int flags) | |||
322 | 322 | ||
323 | 323 | ||
324 | int | 324 | int |
325 | np_runcmd(const char *cmd, output *out, output *err, int flags) | 325 | np_runcmd(const char *cmd, cmd_output *out, cmd_output *err, int flags) |
326 | { | 326 | { |
327 | int fd, pfd_out[2], pfd_err[2]; | 327 | int fd, pfd_out[2], pfd_err[2]; |
328 | 328 | ||
329 | /* initialize the structs */ | 329 | /* initialize the structs */ |
330 | if(out) memset(out, 0, sizeof(output)); | 330 | if(out) memset(out, 0, sizeof(cmd_output)); |
331 | if(err) memset(err, 0, sizeof(output)); | 331 | if(err) memset(err, 0, sizeof(cmd_output)); |
332 | 332 | ||
333 | if((fd = np_runcmd_open(cmd, pfd_out, pfd_err)) == -1) | 333 | if((fd = np_runcmd_open(cmd, pfd_out, pfd_err)) == -1) |
334 | die (STATE_UNKNOWN, _("Could not open pipe: %s\n"), cmd); | 334 | die (STATE_UNKNOWN, _("Could not open pipe: %s\n"), cmd); |
diff --git a/plugins/runcmd.h b/plugins/runcmd.h index 2dcdadf0..14dde581 100644 --- a/plugins/runcmd.h +++ b/plugins/runcmd.h | |||
@@ -28,7 +28,7 @@ | |||
28 | #include "utils_cmd.h" /* for the "output" type */ | 28 | #include "utils_cmd.h" /* for the "output" type */ |
29 | 29 | ||
30 | /** prototypes **/ | 30 | /** prototypes **/ |
31 | int np_runcmd(const char *, output *, output *, int); | 31 | int np_runcmd(const char *, cmd_output *, cmd_output *, int); |
32 | void runcmd_timeout_alarm_handler(int) | 32 | void runcmd_timeout_alarm_handler(int) |
33 | __attribute__((__noreturn__)); | 33 | __attribute__((__noreturn__)); |
34 | 34 | ||