summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBjörn Berg <32747776+MisterMountain@users.noreply.github.com>2023-05-02 07:31:32 (GMT)
committerGitHub <noreply@github.com>2023-05-02 07:31:32 (GMT)
commite14f1ad7c35504b97f81b1b33a5533e57c605fc2 (patch)
treea59d292d928c123ad862776f344918035466c817 /lib
parent3dc677e4f1f990e7b26bc714a02608070379cf85 (diff)
parenta4be133f01a231dc45c98aabed35f96d6f826fd7 (diff)
downloadmonitoring-plugins-e14f1ad7c35504b97f81b1b33a5533e57c605fc2.tar.gz
Merge branch 'monitoring-plugins:master' into fix_version_return_code
Diffstat (limited to 'lib')
-rw-r--r--lib/parse_ini.c4
-rw-r--r--lib/tests/test_cmd.c14
-rw-r--r--lib/tests/test_disk.c4
-rwxr-xr-xlib/tests/test_ini3.t2
-rwxr-xr-xlib/tests/test_opts3.t2
-rw-r--r--lib/tests/test_utils.c2
-rw-r--r--lib/utils_cmd.c2
7 files changed, 15 insertions, 15 deletions
diff --git a/lib/parse_ini.c b/lib/parse_ini.c
index 25abc89..547af43 100644
--- a/lib/parse_ini.c
+++ b/lib/parse_ini.c
@@ -78,7 +78,7 @@ static char *default_file_in_path(void);
78/* 78/*
79 * Parse_locator decomposes a string of the form 79 * Parse_locator decomposes a string of the form
80 * [stanza][@filename] 80 * [stanza][@filename]
81 * into its seperate parts. 81 * into its separate parts.
82 */ 82 */
83static void 83static void
84parse_locator(const char *locator, const char *def_stanza, np_ini_info *i) 84parse_locator(const char *locator, const char *def_stanza, np_ini_info *i)
@@ -169,7 +169,7 @@ read_defaults(FILE *f, const char *stanza, np_arg_list **opts)
169 if (isspace(c)) 169 if (isspace(c))
170 continue; 170 continue;
171 switch (c) { 171 switch (c) {
172 /* globble up coment lines */ 172 /* globble up comment lines */
173 case ';': 173 case ';':
174 case '#': 174 case '#':
175 GOBBLE_TO(f, c, '\n'); 175 GOBBLE_TO(f, c, '\n');
diff --git a/lib/tests/test_cmd.c b/lib/tests/test_cmd.c
index 29ca42a..4bb60aa 100644
--- a/lib/tests/test_cmd.c
+++ b/lib/tests/test_cmd.c
@@ -176,14 +176,14 @@ main (int argc, char **argv)
176 ok (result == UNSET, "(initialised) Checking exit code is reset"); 176 ok (result == UNSET, "(initialised) Checking exit code is reset");
177 177
178 command = (char *)malloc(COMMAND_LINE); 178 command = (char *)malloc(COMMAND_LINE);
179 strcpy(command, "/bin/echo3456 non-existant command"); 179 strcpy(command, "/bin/echo3456 non-existent command");
180 result = cmd_run (command, &chld_out, &chld_err, 0); 180 result = cmd_run (command, &chld_out, &chld_err, 0);
181 181
182 ok (chld_out.lines == 0, 182 ok (chld_out.lines == 0,
183 "Non existant command, so no output"); 183 "Non existent command, so no output");
184 ok (chld_err.lines == 0, 184 ok (chld_err.lines == 0,
185 "No stderr either"); 185 "No stderr either");
186 ok (result == 3, "Get return code 3 (?) for non-existant command"); 186 ok (result == 3, "Get return code 3 (?) for non-existent command");
187 187
188 188
189 /* ensure everything is empty again */ 189 /* ensure everything is empty again */
@@ -192,14 +192,14 @@ main (int argc, char **argv)
192 result = UNSET; 192 result = UNSET;
193 193
194 command = (char *)malloc(COMMAND_LINE); 194 command = (char *)malloc(COMMAND_LINE);
195 strcpy(command, "/bin/sh non-existant-file"); 195 strcpy(command, "/bin/sh non-existent-file");
196 result = cmd_run (command, &chld_out, &chld_err, 0); 196 result = cmd_run (command, &chld_out, &chld_err, 0);
197 197
198 ok (chld_out.lines == 0, 198 ok (chld_out.lines == 0,
199 "/bin/sh returns no stdout when file is missing..."); 199 "/bin/sh returns no stdout when file is missing...");
200 ok (chld_err.lines == 1, 200 ok (chld_err.lines == 1,
201 "...but does give an error line"); 201 "...but does give an error line");
202 ok (strstr(chld_err.line[0],"non-existant-file") != NULL, "And missing filename is in error message"); 202 ok (strstr(chld_err.line[0],"non-existent-file") != NULL, "And missing filename is in error message");
203 ok (result != 0, "Get non-zero return code from /bin/sh"); 203 ok (result != 0, "Get non-zero return code from /bin/sh");
204 204
205 205
@@ -219,11 +219,11 @@ main (int argc, char **argv)
219 result = UNSET; 219 result = UNSET;
220 220
221 command = (char *)malloc(COMMAND_LINE); 221 command = (char *)malloc(COMMAND_LINE);
222 strcpy(command, "/bin/non-existant-command"); 222 strcpy(command, "/bin/non-existent-command");
223 result = cmd_run (command, &chld_out, &chld_err, 0); 223 result = cmd_run (command, &chld_out, &chld_err, 0);
224 224
225 ok (chld_out.lines == 0, 225 ok (chld_out.lines == 0,
226 "/bin/non-existant-command returns no stdout..."); 226 "/bin/non-existent-command returns no stdout...");
227 ok (chld_err.lines == 0, 227 ok (chld_err.lines == 0,
228 "...and no stderr output either"); 228 "...and no stderr output either");
229 ok (result == 3, "Get return code 3 = UNKNOWN when command does not exist"); 229 ok (result == 3, "Get return code 3 = UNKNOWN when command does not exist");
diff --git a/lib/tests/test_disk.c b/lib/tests/test_disk.c
index f6477ac..9bd68c7 100644
--- a/lib/tests/test_disk.c
+++ b/lib/tests/test_disk.c
@@ -88,10 +88,10 @@ main (int argc, char **argv)
88 cflags, 3,strdup("regex on dev names:")); 88 cflags, 3,strdup("regex on dev names:"));
89 np_test_mount_entry_regex(dummy_mount_list, strdup("/foo"), 89 np_test_mount_entry_regex(dummy_mount_list, strdup("/foo"),
90 cflags, 0, 90 cflags, 0,
91 strdup("regex on non existant dev/path:")); 91 strdup("regex on non existent dev/path:"));
92 np_test_mount_entry_regex(dummy_mount_list, strdup("/Foo"), 92 np_test_mount_entry_regex(dummy_mount_list, strdup("/Foo"),
93 cflags | REG_ICASE,0, 93 cflags | REG_ICASE,0,
94 strdup("regi on non existant dev/path:")); 94 strdup("regi on non existent dev/path:"));
95 np_test_mount_entry_regex(dummy_mount_list, strdup("/c.t0"), 95 np_test_mount_entry_regex(dummy_mount_list, strdup("/c.t0"),
96 cflags, 3, 96 cflags, 3,
97 strdup("partial devname regex match:")); 97 strdup("partial devname regex match:"));
diff --git a/lib/tests/test_ini3.t b/lib/tests/test_ini3.t
index a2ca94a..41169db 100755
--- a/lib/tests/test_ini3.t
+++ b/lib/tests/test_ini3.t
@@ -10,7 +10,7 @@ if (! -e "./test_ini3") {
10# array of argument arrays 10# array of argument arrays
11# - First value is the expected return code 11# - First value is the expected return code
12# - 2nd value is the NAGIOS_CONFIG_PATH 12# - 2nd value is the NAGIOS_CONFIG_PATH
13# TODO: looks like we look in default path after looking trough this variable - shall we? 13# TODO: looks like we look in default path after looking through this variable - shall we?
14# - 3rd value is the plugin name 14# - 3rd value is the plugin name
15# - 4th is the ini locator 15# - 4th is the ini locator
16my @TESTS = ( 16my @TESTS = (
diff --git a/lib/tests/test_opts3.t b/lib/tests/test_opts3.t
index 8d974ca..d77a35c 100755
--- a/lib/tests/test_opts3.t
+++ b/lib/tests/test_opts3.t
@@ -10,7 +10,7 @@ if (! -e "./test_opts3") {
10# array of argument arrays 10# array of argument arrays
11# - First value is the expected return code 11# - First value is the expected return code
12# - 2nd value is the NAGIOS_CONFIG_PATH 12# - 2nd value is the NAGIOS_CONFIG_PATH
13# TODO: looks like we look in default path after looking trough this variable - shall we? 13# TODO: looks like we look in default path after looking through this variable - shall we?
14# - 3rd value is the plugin name 14# - 3rd value is the plugin name
15# - 4th and up are arguments 15# - 4th and up are arguments
16my @TESTS = ( 16my @TESTS = (
diff --git a/lib/tests/test_utils.c b/lib/tests/test_utils.c
index bc00fac..7b10494 100644
--- a/lib/tests/test_utils.c
+++ b/lib/tests/test_utils.c
@@ -395,7 +395,7 @@ main (int argc, char **argv)
395 ok( temp_state_data==NULL, "Older data version gives NULL" ); 395 ok( temp_state_data==NULL, "Older data version gives NULL" );
396 temp_state_key->data_version=54; 396 temp_state_key->data_version=54;
397 397
398 temp_state_key->_filename="var/nonexistant"; 398 temp_state_key->_filename="var/nonexistent";
399 temp_state_data = np_state_read(); 399 temp_state_data = np_state_read();
400 ok( temp_state_data==NULL, "Missing file gives NULL" ); 400 ok( temp_state_data==NULL, "Missing file gives NULL" );
401 ok( this_monitoring_plugin->state->state_data==NULL, "No state information" ); 401 ok( this_monitoring_plugin->state->state_data==NULL, "No state information" );
diff --git a/lib/utils_cmd.c b/lib/utils_cmd.c
index 795840d..8b8e570 100644
--- a/lib/utils_cmd.c
+++ b/lib/utils_cmd.c
@@ -161,7 +161,7 @@ _cmd_open (char *const *argv, int *pfd, int *pfderr)
161 } 161 }
162 162
163 /* parent picks up execution here */ 163 /* parent picks up execution here */
164 /* close childs descriptors in our address space */ 164 /* close children descriptors in our address space */
165 close (pfd[1]); 165 close (pfd[1]);
166 close (pfderr[1]); 166 close (pfderr[1]);
167 167