summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/extra_opts.c12
-rw-r--r--lib/parse_ini.c14
-rw-r--r--lib/tests/test_base64.c10
-rw-r--r--lib/tests/test_cmd.c10
-rw-r--r--lib/tests/test_disk.c18
-rw-r--r--lib/tests/test_ini1.c10
-rw-r--r--lib/tests/test_ini3.c10
-rw-r--r--lib/tests/test_opts2.c2
-rw-r--r--lib/tests/test_tcp.c14
-rw-r--r--lib/tests/test_utils.c21
-rw-r--r--lib/utils_base.c24
-rw-r--r--lib/utils_base.h4
-rw-r--r--lib/utils_cmd.c12
-rw-r--r--lib/utils_cmd.h6
-rw-r--r--lib/utils_disk.c23
-rw-r--r--lib/utils_tcp.c20
16 files changed, 104 insertions, 106 deletions
diff --git a/lib/extra_opts.c b/lib/extra_opts.c
index f4d5e66..89b1056 100644
--- a/lib/extra_opts.c
+++ b/lib/extra_opts.c
@@ -1,23 +1,23 @@
1/***************************************************************************** 1/*****************************************************************************
2* 2*
3* Monitoring Plugins extra_opts library 3* Monitoring Plugins extra_opts library
4* 4*
5* License: GPL 5* License: GPL
6* Copyright (c) 2007 Monitoring Plugins Development Team 6* Copyright (c) 2007 Monitoring Plugins Development Team
7* 7*
8* This program is free software: you can redistribute it and/or modify 8* This program is free software: you can redistribute it and/or modify
9* it under the terms of the GNU General Public License as published by 9* it under the terms of the GNU General Public License as published by
10* the Free Software Foundation, either version 3 of the License, or 10* the Free Software Foundation, either version 3 of the License, or
11* (at your option) any later version. 11* (at your option) any later version.
12* 12*
13* This program is distributed in the hope that it will be useful, 13* This program is distributed in the hope that it will be useful,
14* but WITHOUT ANY WARRANTY; without even the implied warranty of 14* but WITHOUT ANY WARRANTY; without even the implied warranty of
15* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16* GNU General Public License for more details. 16* GNU General Public License for more details.
17* 17*
18* You should have received a copy of the GNU General Public License 18* You should have received a copy of the GNU General Public License
19* along with this program. If not, see <http://www.gnu.org/licenses/>. 19* along with this program. If not, see <http://www.gnu.org/licenses/>.
20* 20*
21*****************************************************************************/ 21*****************************************************************************/
22 22
23#include "common.h" 23#include "common.h"
diff --git a/lib/parse_ini.c b/lib/parse_ini.c
index 547af43..57e6094 100644
--- a/lib/parse_ini.c
+++ b/lib/parse_ini.c
@@ -1,24 +1,24 @@
1/***************************************************************************** 1/*****************************************************************************
2* 2*
3* Monitoring Plugins parse_ini library 3* Monitoring Plugins parse_ini library
4* 4*
5* License: GPL 5* License: GPL
6* Copyright (c) 2007 Monitoring Plugins Development Team 6* Copyright (c) 2007 Monitoring Plugins Development Team
7* 7*
8* This program is free software: you can redistribute it and/or modify 8* This program is free software: you can redistribute it and/or modify
9* it under the terms of the GNU General Public License as published by 9* it under the terms of the GNU General Public License as published by
10* the Free Software Foundation, either version 3 of the License, or 10* the Free Software Foundation, either version 3 of the License, or
11* (at your option) any later version. 11* (at your option) any later version.
12* 12*
13* This program is distributed in the hope that it will be useful, 13* This program is distributed in the hope that it will be useful,
14* but WITHOUT ANY WARRANTY; without even the implied warranty of 14* but WITHOUT ANY WARRANTY; without even the implied warranty of
15* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16* GNU General Public License for more details. 16* GNU General Public License for more details.
17* 17*
18* You should have received a copy of the GNU General Public License 18* You should have received a copy of the GNU General Public License
19* along with this program. If not, see <http://www.gnu.org/licenses/>. 19* along with this program. If not, see <http://www.gnu.org/licenses/>.
20* 20*
21* 21*
22*****************************************************************************/ 22*****************************************************************************/
23 23
24#include "common.h" 24#include "common.h"
diff --git a/lib/tests/test_base64.c b/lib/tests/test_base64.c
index 5103d10..05dd794 100644
--- a/lib/tests/test_base64.c
+++ b/lib/tests/test_base64.c
@@ -1,19 +1,19 @@
1/***************************************************************************** 1/*****************************************************************************
2* 2*
3* This program is free software: you can redistribute it and/or modify 3* This program is free software: you can redistribute it and/or modify
4* it under the terms of the GNU General Public License as published by 4* it under the terms of the GNU General Public License as published by
5* the Free Software Foundation, either version 3 of the License, or 5* the Free Software Foundation, either version 3 of the License, or
6* (at your option) any later version. 6* (at your option) any later version.
7* 7*
8* This program is distributed in the hope that it will be useful, 8* This program is distributed in the hope that it will be useful,
9* but WITHOUT ANY WARRANTY; without even the implied warranty of 9* but WITHOUT ANY WARRANTY; without even the implied warranty of
10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11* GNU General Public License for more details. 11* GNU General Public License for more details.
12* 12*
13* You should have received a copy of the GNU General Public License 13* You should have received a copy of the GNU General Public License
14* along with this program. If not, see <http://www.gnu.org/licenses/>. 14* along with this program. If not, see <http://www.gnu.org/licenses/>.
15* 15*
16* 16*
17*****************************************************************************/ 17*****************************************************************************/
18 18
19#include "common.h" 19#include "common.h"
diff --git a/lib/tests/test_cmd.c b/lib/tests/test_cmd.c
index 4bb60aa..02ae11f 100644
--- a/lib/tests/test_cmd.c
+++ b/lib/tests/test_cmd.c
@@ -1,19 +1,19 @@
1/***************************************************************************** 1/*****************************************************************************
2* 2*
3* This program is free software: you can redistribute it and/or modify 3* This program is free software: you can redistribute it and/or modify
4* it under the terms of the GNU General Public License as published by 4* it under the terms of the GNU General Public License as published by
5* the Free Software Foundation, either version 3 of the License, or 5* the Free Software Foundation, either version 3 of the License, or
6* (at your option) any later version. 6* (at your option) any later version.
7* 7*
8* This program is distributed in the hope that it will be useful, 8* This program is distributed in the hope that it will be useful,
9* but WITHOUT ANY WARRANTY; without even the implied warranty of 9* but WITHOUT ANY WARRANTY; without even the implied warranty of
10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11* GNU General Public License for more details. 11* GNU General Public License for more details.
12* 12*
13* You should have received a copy of the GNU General Public License 13* You should have received a copy of the GNU General Public License
14* along with this program. If not, see <http://www.gnu.org/licenses/>. 14* along with this program. If not, see <http://www.gnu.org/licenses/>.
15* 15*
16* 16*
17*****************************************************************************/ 17*****************************************************************************/
18 18
19#include "common.h" 19#include "common.h"
diff --git a/lib/tests/test_disk.c b/lib/tests/test_disk.c
index 9bd68c7..269d20b 100644
--- a/lib/tests/test_disk.c
+++ b/lib/tests/test_disk.c
@@ -1,19 +1,19 @@
1/***************************************************************************** 1/*****************************************************************************
2* 2*
3* This program is free software: you can redistribute it and/or modify 3* This program is free software: you can redistribute it and/or modify
4* it under the terms of the GNU General Public License as published by 4* it under the terms of the GNU General Public License as published by
5* the Free Software Foundation, either version 3 of the License, or 5* the Free Software Foundation, either version 3 of the License, or
6* (at your option) any later version. 6* (at your option) any later version.
7* 7*
8* This program is distributed in the hope that it will be useful, 8* This program is distributed in the hope that it will be useful,
9* but WITHOUT ANY WARRANTY; without even the implied warranty of 9* but WITHOUT ANY WARRANTY; without even the implied warranty of
10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11* GNU General Public License for more details. 11* GNU General Public License for more details.
12* 12*
13* You should have received a copy of the GNU General Public License 13* You should have received a copy of the GNU General Public License
14* along with this program. If not, see <http://www.gnu.org/licenses/>. 14* along with this program. If not, see <http://www.gnu.org/licenses/>.
15* 15*
16* 16*
17*****************************************************************************/ 17*****************************************************************************/
18 18
19#include "common.h" 19#include "common.h"
@@ -167,7 +167,7 @@ main (int argc, char **argv)
167 } 167 }
168 ok(found == 0, "first element successfully deleted"); 168 ok(found == 0, "first element successfully deleted");
169 found = 0; 169 found = 0;
170 170
171 p=paths; 171 p=paths;
172 while (p) { 172 while (p) {
173 if (! strcmp(p->name, "/tmp")) 173 if (! strcmp(p->name, "/tmp"))
@@ -203,9 +203,9 @@ main (int argc, char **argv)
203} 203}
204 204
205 205
206void 206void
207np_test_mount_entry_regex (struct mount_entry *dummy_mount_list, char *regstr, int cflags, int expect, char *desc) 207np_test_mount_entry_regex (struct mount_entry *dummy_mount_list, char *regstr, int cflags, int expect, char *desc)
208{ 208{
209 int matches = 0; 209 int matches = 0;
210 regex_t re; 210 regex_t re;
211 struct mount_entry *me; 211 struct mount_entry *me;
@@ -214,7 +214,7 @@ np_test_mount_entry_regex (struct mount_entry *dummy_mount_list, char *regstr, i
214 if(np_regex_match_mount_entry(me,&re)) 214 if(np_regex_match_mount_entry(me,&re))
215 matches++; 215 matches++;
216 } 216 }
217 ok( matches == expect, 217 ok( matches == expect,
218 "%s '%s' matched %i/3 entries. ok: %i/3", 218 "%s '%s' matched %i/3 entries. ok: %i/3",
219 desc, regstr, expect, matches); 219 desc, regstr, expect, matches);
220 220
diff --git a/lib/tests/test_ini1.c b/lib/tests/test_ini1.c
index 77f8854..6843bac 100644
--- a/lib/tests/test_ini1.c
+++ b/lib/tests/test_ini1.c
@@ -1,19 +1,19 @@
1/***************************************************************************** 1/*****************************************************************************
2* 2*
3* This program is free software: you can redistribute it and/or modify 3* This program is free software: you can redistribute it and/or modify
4* it under the terms of the GNU General Public License as published by 4* it under the terms of the GNU General Public License as published by
5* the Free Software Foundation, either version 3 of the License, or 5* the Free Software Foundation, either version 3 of the License, or
6* (at your option) any later version. 6* (at your option) any later version.
7* 7*
8* This program is distributed in the hope that it will be useful, 8* This program is distributed in the hope that it will be useful,
9* but WITHOUT ANY WARRANTY; without even the implied warranty of 9* but WITHOUT ANY WARRANTY; without even the implied warranty of
10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11* GNU General Public License for more details. 11* GNU General Public License for more details.
12* 12*
13* You should have received a copy of the GNU General Public License 13* You should have received a copy of the GNU General Public License
14* along with this program. If not, see <http://www.gnu.org/licenses/>. 14* along with this program. If not, see <http://www.gnu.org/licenses/>.
15* 15*
16* 16*
17*****************************************************************************/ 17*****************************************************************************/
18 18
19#include "common.h" 19#include "common.h"
diff --git a/lib/tests/test_ini3.c b/lib/tests/test_ini3.c
index 814b3ec..8a2a041 100644
--- a/lib/tests/test_ini3.c
+++ b/lib/tests/test_ini3.c
@@ -1,19 +1,19 @@
1/***************************************************************************** 1/*****************************************************************************
2* 2*
3* This program is free software: you can redistribute it and/or modify 3* This program is free software: you can redistribute it and/or modify
4* it under the terms of the GNU General Public License as published by 4* it under the terms of the GNU General Public License as published by
5* the Free Software Foundation, either version 3 of the License, or 5* the Free Software Foundation, either version 3 of the License, or
6* (at your option) any later version. 6* (at your option) any later version.
7* 7*
8* This program is distributed in the hope that it will be useful, 8* This program is distributed in the hope that it will be useful,
9* but WITHOUT ANY WARRANTY; without even the implied warranty of 9* but WITHOUT ANY WARRANTY; without even the implied warranty of
10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11* GNU General Public License for more details. 11* GNU General Public License for more details.
12* 12*
13* You should have received a copy of the GNU General Public License 13* You should have received a copy of the GNU General Public License
14* along with this program. If not, see <http://www.gnu.org/licenses/>. 14* along with this program. If not, see <http://www.gnu.org/licenses/>.
15* 15*
16* 16*
17*****************************************************************************/ 17*****************************************************************************/
18 18
19#include "parse_ini.h" 19#include "parse_ini.h"
diff --git a/lib/tests/test_opts2.c b/lib/tests/test_opts2.c
index c3d2067..780220e 100644
--- a/lib/tests/test_opts2.c
+++ b/lib/tests/test_opts2.c
@@ -12,7 +12,7 @@
12* 12*
13* You should have received a copy of the GNU General Public License 13* You should have received a copy of the GNU General Public License
14* along with this program. If not, see <http://www.gnu.org/licenses/>. 14* along with this program. If not, see <http://www.gnu.org/licenses/>.
15* 15*
16*****************************************************************************/ 16*****************************************************************************/
17 17
18#include "common.h" 18#include "common.h"
diff --git a/lib/tests/test_tcp.c b/lib/tests/test_tcp.c
index 114252b..1954b0f 100644
--- a/lib/tests/test_tcp.c
+++ b/lib/tests/test_tcp.c
@@ -1,19 +1,19 @@
1/***************************************************************************** 1/*****************************************************************************
2* 2*
3* This program is free software: you can redistribute it and/or modify 3* This program is free software: you can redistribute it and/or modify
4* it under the terms of the GNU General Public License as published by 4* it under the terms of the GNU General Public License as published by
5* the Free Software Foundation, either version 3 of the License, or 5* the Free Software Foundation, either version 3 of the License, or
6* (at your option) any later version. 6* (at your option) any later version.
7* 7*
8* This program is distributed in the hope that it will be useful, 8* This program is distributed in the hope that it will be useful,
9* but WITHOUT ANY WARRANTY; without even the implied warranty of 9* but WITHOUT ANY WARRANTY; without even the implied warranty of
10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11* GNU General Public License for more details. 11* GNU General Public License for more details.
12* 12*
13* You should have received a copy of the GNU General Public License 13* You should have received a copy of the GNU General Public License
14* along with this program. If not, see <http://www.gnu.org/licenses/>. 14* along with this program. If not, see <http://www.gnu.org/licenses/>.
15* 15*
16* 16*
17*****************************************************************************/ 17*****************************************************************************/
18 18
19#include "common.h" 19#include "common.h"
@@ -33,7 +33,7 @@ main(void)
33 server_expect[0] = strdup("AA"); 33 server_expect[0] = strdup("AA");
34 server_expect[1] = strdup("bb"); 34 server_expect[1] = strdup("bb");
35 server_expect[2] = strdup("CC"); 35 server_expect[2] = strdup("CC");
36 36
37 ok(np_expect_match("AA bb CC XX", server_expect, server_expect_count, NP_MATCH_EXACT) == NP_MATCH_SUCCESS, 37 ok(np_expect_match("AA bb CC XX", server_expect, server_expect_count, NP_MATCH_EXACT) == NP_MATCH_SUCCESS,
38 "Test matching any string at the beginning (first expect string)"); 38 "Test matching any string at the beginning (first expect string)");
39 ok(np_expect_match("bb AA CC XX", server_expect, server_expect_count, NP_MATCH_EXACT) == NP_MATCH_SUCCESS, 39 ok(np_expect_match("bb AA CC XX", server_expect, server_expect_count, NP_MATCH_EXACT) == NP_MATCH_SUCCESS,
@@ -52,7 +52,7 @@ main(void)
52 "Test not matching all strings"); 52 "Test not matching all strings");
53 ok(np_expect_match("XX XX", server_expect, server_expect_count, NP_MATCH_ALL) == NP_MATCH_RETRY, 53 ok(np_expect_match("XX XX", server_expect, server_expect_count, NP_MATCH_ALL) == NP_MATCH_RETRY,
54 "Test not matching any string (testing all)"); 54 "Test not matching any string (testing all)");
55 55
56 56
57 return exit_status(); 57 return exit_status();
58} 58}
diff --git a/lib/tests/test_utils.c b/lib/tests/test_utils.c
index 7b10494..a109e3f 100644
--- a/lib/tests/test_utils.c
+++ b/lib/tests/test_utils.c
@@ -1,19 +1,19 @@
1/***************************************************************************** 1/*****************************************************************************
2* 2*
3* This program is free software: you can redistribute it and/or modify 3* This program is free software: you can redistribute it and/or modify
4* it under the terms of the GNU General Public License as published by 4* it under the terms of the GNU General Public License as published by
5* the Free Software Foundation, either version 3 of the License, or 5* the Free Software Foundation, either version 3 of the License, or
6* (at your option) any later version. 6* (at your option) any later version.
7* 7*
8* This program is distributed in the hope that it will be useful, 8* This program is distributed in the hope that it will be useful,
9* but WITHOUT ANY WARRANTY; without even the implied warranty of 9* but WITHOUT ANY WARRANTY; without even the implied warranty of
10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11* GNU General Public License for more details. 11* GNU General Public License for more details.
12* 12*
13* You should have received a copy of the GNU General Public License 13* You should have received a copy of the GNU General Public License
14* along with this program. If not, see <http://www.gnu.org/licenses/>. 14* along with this program. If not, see <http://www.gnu.org/licenses/>.
15* 15*
16* 16*
17*****************************************************************************/ 17*****************************************************************************/
18 18
19#include "common.h" 19#include "common.h"
@@ -377,13 +377,13 @@ main (int argc, char **argv)
377 377
378/* 378/*
379 temp_fp = fopen("var/statefile", "r"); 379 temp_fp = fopen("var/statefile", "r");
380 if (temp_fp==NULL) 380 if (temp_fp==NULL)
381 printf("Error opening. errno=%d\n", errno); 381 printf("Error opening. errno=%d\n", errno);
382 printf("temp_fp=%s\n", temp_fp); 382 printf("temp_fp=%s\n", temp_fp);
383 ok( _np_state_read_file(temp_fp) == TRUE, "Can read state file" ); 383 ok( _np_state_read_file(temp_fp) == true, "Can read state file" );
384 fclose(temp_fp); 384 fclose(temp_fp);
385*/ 385*/
386 386
387 temp_state_key->_filename="var/statefile"; 387 temp_state_key->_filename="var/statefile";
388 temp_state_data = np_state_read(); 388 temp_state_data = np_state_read();
389 ok( this_monitoring_plugin->state->state_data!=NULL, "Got state data now" ) || diag("Are you running in right directory? Will get coredump next if not"); 389 ok( this_monitoring_plugin->state->state_data!=NULL, "Got state data now" ) || diag("Are you running in right directory? Will get coredump next if not");
@@ -446,14 +446,14 @@ main (int argc, char **argv)
446 /* Check time is set to current_time */ 446 /* Check time is set to current_time */
447 ok(system("cmp var/generated var/statefile > /dev/null")!=0, "Generated file should be different this time"); 447 ok(system("cmp var/generated var/statefile > /dev/null")!=0, "Generated file should be different this time");
448 ok(this_monitoring_plugin->state->state_data->time-current_time<=1, "Has time generated from current time"); 448 ok(this_monitoring_plugin->state->state_data->time-current_time<=1, "Has time generated from current time");
449 449
450 450
451 /* Don't know how to automatically test this. Need to be able to redefine die and catch the error */ 451 /* Don't know how to automatically test this. Need to be able to redefine die and catch the error */
452 /* 452 /*
453 temp_state_key->_filename="/dev/do/not/expect/to/be/able/to/write"; 453 temp_state_key->_filename="/dev/do/not/expect/to/be/able/to/write";
454 np_state_write_string(0, "Bad file"); 454 np_state_write_string(0, "Bad file");
455 */ 455 */
456 456
457 457
458 np_cleanup(); 458 np_cleanup();
459 459
@@ -508,4 +508,3 @@ main (int argc, char **argv)
508 508
509 return exit_status(); 509 return exit_status();
510} 510}
511
diff --git a/lib/utils_base.c b/lib/utils_base.c
index 0f52126..eabcd7e 100644
--- a/lib/utils_base.c
+++ b/lib/utils_base.c
@@ -6,21 +6,21 @@
6* Copyright (c) 2006 Monitoring Plugins Development Team 6* Copyright (c) 2006 Monitoring Plugins Development Team
7* 7*
8* Library of useful functions for plugins 8* Library of useful functions for plugins
9* 9*
10* 10*
11* This program is free software: you can redistribute it and/or modify 11* This program is free software: you can redistribute it and/or modify
12* it under the terms of the GNU General Public License as published by 12* it under the terms of the GNU General Public License as published by
13* the Free Software Foundation, either version 3 of the License, or 13* the Free Software Foundation, either version 3 of the License, or
14* (at your option) any later version. 14* (at your option) any later version.
15* 15*
16* This program is distributed in the hope that it will be useful, 16* This program is distributed in the hope that it will be useful,
17* but WITHOUT ANY WARRANTY; without even the implied warranty of 17* but WITHOUT ANY WARRANTY; without even the implied warranty of
18* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19* GNU General Public License for more details. 19* GNU General Public License for more details.
20* 20*
21* You should have received a copy of the GNU General Public License 21* You should have received a copy of the GNU General Public License
22* along with this program. If not, see <http://www.gnu.org/licenses/>. 22* along with this program. If not, see <http://www.gnu.org/licenses/>.
23* 23*
24* 24*
25*****************************************************************************/ 25*****************************************************************************/
26 26
@@ -640,10 +640,10 @@ int _np_state_read_file(FILE *f) {
640} 640}
641 641
642/* 642/*
643 * If time=NULL, use current time. Create state file, with state format 643 * If time=NULL, use current time. Create state file, with state format
644 * version, default text. Writes version, time, and data. Avoid locking 644 * version, default text. Writes version, time, and data. Avoid locking
645 * problems - use mv to write and then swap. Possible loss of state data if 645 * problems - use mv to write and then swap. Possible loss of state data if
646 * two things writing to same key at same time. 646 * two things writing to same key at same time.
647 * Will die with UNKNOWN if errors 647 * Will die with UNKNOWN if errors
648 */ 648 */
649void np_state_write_string(time_t data_time, char *data_string) { 649void np_state_write_string(time_t data_time, char *data_string) {
@@ -658,7 +658,7 @@ void np_state_write_string(time_t data_time, char *data_string) {
658 time(&current_time); 658 time(&current_time);
659 else 659 else
660 current_time=data_time; 660 current_time=data_time;
661 661
662 /* If file doesn't currently exist, create directories */ 662 /* If file doesn't currently exist, create directories */
663 if(access(this_monitoring_plugin->state->_filename,F_OK)!=0) { 663 if(access(this_monitoring_plugin->state->_filename,F_OK)!=0) {
664 result = asprintf(&directories, "%s", this_monitoring_plugin->state->_filename); 664 result = asprintf(&directories, "%s", this_monitoring_plugin->state->_filename);
@@ -697,15 +697,15 @@ void np_state_write_string(time_t data_time, char *data_string) {
697 np_free(temp_file); 697 np_free(temp_file);
698 die(STATE_UNKNOWN, _("Unable to open temporary state file")); 698 die(STATE_UNKNOWN, _("Unable to open temporary state file"));
699 } 699 }
700 700
701 fprintf(fp,"# NP State file\n"); 701 fprintf(fp,"# NP State file\n");
702 fprintf(fp,"%d\n",NP_STATE_FORMAT_VERSION); 702 fprintf(fp,"%d\n",NP_STATE_FORMAT_VERSION);
703 fprintf(fp,"%d\n",this_monitoring_plugin->state->data_version); 703 fprintf(fp,"%d\n",this_monitoring_plugin->state->data_version);
704 fprintf(fp,"%lu\n",current_time); 704 fprintf(fp,"%lu\n",current_time);
705 fprintf(fp,"%s\n",data_string); 705 fprintf(fp,"%s\n",data_string);
706 706
707 fchmod(fd, S_IRUSR | S_IWUSR | S_IRGRP); 707 fchmod(fd, S_IRUSR | S_IWUSR | S_IRGRP);
708 708
709 fflush(fp); 709 fflush(fp);
710 710
711 result=fclose(fp); 711 result=fclose(fp);
diff --git a/lib/utils_base.h b/lib/utils_base.h
index 9cb4276..9abf595 100644
--- a/lib/utils_base.h
+++ b/lib/utils_base.h
@@ -6,7 +6,7 @@
6# include "sha256.h" 6# include "sha256.h"
7#endif 7#endif
8 8
9/* This file holds header information for thresholds - use this in preference to 9/* This file holds header information for thresholds - use this in preference to
10 individual plugin logic */ 10 individual plugin logic */
11 11
12/* This has not been merged with utils.h because of problems with 12/* This has not been merged with utils.h because of problems with
@@ -79,7 +79,7 @@ void die (int, const char *, ...) __attribute__((noreturn,format(printf, 2, 3)))
79#define NP_RANGE_UNPARSEABLE 1 79#define NP_RANGE_UNPARSEABLE 1
80#define NP_WARN_WITHIN_CRIT 2 80#define NP_WARN_WITHIN_CRIT 2
81 81
82/* a simple check to see if we're running as root. 82/* a simple check to see if we're running as root.
83 * returns zero on failure, nonzero on success */ 83 * returns zero on failure, nonzero on success */
84int np_check_if_root(void); 84int np_check_if_root(void);
85 85
diff --git a/lib/utils_cmd.c b/lib/utils_cmd.c
index f66fd57..cfb2073 100644
--- a/lib/utils_cmd.c
+++ b/lib/utils_cmd.c
@@ -18,18 +18,18 @@
18* Care has been taken to make sure the functions are async-safe. The one 18* Care has been taken to make sure the functions are async-safe. The one
19* function which isn't is cmd_init() which it doesn't make sense to 19* function which isn't is cmd_init() which it doesn't make sense to
20* call twice anyway, so the api as a whole should be considered async-safe. 20* call twice anyway, so the api as a whole should be considered async-safe.
21* 21*
22* 22*
23* This program is free software: you can redistribute it and/or modify 23* This program is free software: you can redistribute it and/or modify
24* it under the terms of the GNU General Public License as published by 24* it under the terms of the GNU General Public License as published by
25* the Free Software Foundation, either version 3 of the License, or 25* the Free Software Foundation, either version 3 of the License, or
26* (at your option) any later version. 26* (at your option) any later version.
27* 27*
28* This program is distributed in the hope that it will be useful, 28* This program is distributed in the hope that it will be useful,
29* but WITHOUT ANY WARRANTY; without even the implied warranty of 29* but WITHOUT ANY WARRANTY; without even the implied warranty of
30* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 30* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31* GNU General Public License for more details. 31* GNU General Public License for more details.
32* 32*
33* You should have received a copy of the GNU General Public License 33* You should have received a copy of the GNU General Public License
34* along with this program. If not, see <http://www.gnu.org/licenses/>. 34* along with this program. If not, see <http://www.gnu.org/licenses/>.
35* 35*
@@ -377,10 +377,10 @@ cmd_file_read ( char *filename, output *out, int flags)
377 if ((fd = open(filename, O_RDONLY)) == -1) { 377 if ((fd = open(filename, O_RDONLY)) == -1) {
378 die( STATE_UNKNOWN, _("Error opening %s: %s"), filename, strerror(errno) ); 378 die( STATE_UNKNOWN, _("Error opening %s: %s"), filename, strerror(errno) );
379 } 379 }
380 380
381 if(out) 381 if(out)
382 out->lines = _cmd_fetch_output (fd, out, flags); 382 out->lines = _cmd_fetch_output (fd, out, flags);
383 383
384 if (close(fd) == -1) 384 if (close(fd) == -1)
385 die( STATE_UNKNOWN, _("Error closing %s: %s"), filename, strerror(errno) ); 385 die( STATE_UNKNOWN, _("Error closing %s: %s"), filename, strerror(errno) );
386 386
diff --git a/lib/utils_cmd.h b/lib/utils_cmd.h
index f1b06c8..061f5d4 100644
--- a/lib/utils_cmd.h
+++ b/lib/utils_cmd.h
@@ -1,10 +1,10 @@
1#ifndef _UTILS_CMD_ 1#ifndef _UTILS_CMD_
2#define _UTILS_CMD_ 2#define _UTILS_CMD_
3 3
4/* 4/*
5 * Header file for Monitoring Plugins utils_cmd.c 5 * Header file for Monitoring Plugins utils_cmd.c
6 * 6 *
7 * 7 *
8 */ 8 */
9 9
10/** types **/ 10/** types **/
diff --git a/lib/utils_disk.c b/lib/utils_disk.c
index f5ac0b3..5e95aef 100644
--- a/lib/utils_disk.c
+++ b/lib/utils_disk.c
@@ -1,29 +1,29 @@
1/***************************************************************************** 1/*****************************************************************************
2* 2*
3* Library for check_disk 3* Library for check_disk
4* 4*
5* License: GPL 5* License: GPL
6* Copyright (c) 1999-2007 Monitoring Plugins Development Team 6* Copyright (c) 1999-2007 Monitoring Plugins Development Team
7* 7*
8* Description: 8* Description:
9* 9*
10* This file contains utilities for check_disk. These are tested by libtap 10* This file contains utilities for check_disk. These are tested by libtap
11* 11*
12* 12*
13* This program is free software: you can redistribute it and/or modify 13* This program is free software: you can redistribute it and/or modify
14* it under the terms of the GNU General Public License as published by 14* it under the terms of the GNU General Public License as published by
15* the Free Software Foundation, either version 3 of the License, or 15* the Free Software Foundation, either version 3 of the License, or
16* (at your option) any later version. 16* (at your option) any later version.
17* 17*
18* This program is distributed in the hope that it will be useful, 18* This program is distributed in the hope that it will be useful,
19* but WITHOUT ANY WARRANTY; without even the implied warranty of 19* but WITHOUT ANY WARRANTY; without even the implied warranty of
20* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21* GNU General Public License for more details. 21* GNU General Public License for more details.
22* 22*
23* You should have received a copy of the GNU General Public License 23* You should have received a copy of the GNU General Public License
24* along with this program. If not, see <http://www.gnu.org/licenses/>. 24* along with this program. If not, see <http://www.gnu.org/licenses/>.
25* 25*
26* 26*
27*****************************************************************************/ 27*****************************************************************************/
28 28
29#include "common.h" 29#include "common.h"
@@ -98,7 +98,7 @@ np_add_parameter(struct parameter_list **list, const char *name)
98 new_path->freeinodes_percent = NULL; 98 new_path->freeinodes_percent = NULL;
99 new_path->group = NULL; 99 new_path->group = NULL;
100 new_path->dfree_pct = -1; 100 new_path->dfree_pct = -1;
101 new_path->dused_pct = -1; 101 new_path->dused_pct = -1;
102 new_path->total = 0; 102 new_path->total = 0;
103 new_path->available = 0; 103 new_path->available = 0;
104 new_path->available_to_root = 0; 104 new_path->available_to_root = 0;
@@ -279,4 +279,3 @@ np_regex_match_mount_entry (struct mount_entry* me, regex_t* re)
279 return FALSE; 279 return FALSE;
280 } 280 }
281} 281}
282
diff --git a/lib/utils_tcp.c b/lib/utils_tcp.c
index b37c446..23ee4a9 100644
--- a/lib/utils_tcp.c
+++ b/lib/utils_tcp.c
@@ -1,29 +1,29 @@
1/***************************************************************************** 1/*****************************************************************************
2* 2*
3* Library for check_tcp 3* Library for check_tcp
4* 4*
5* License: GPL 5* License: GPL
6* Copyright (c) 1999-2013 Monitoring Plugins Development Team 6* Copyright (c) 1999-2013 Monitoring Plugins Development Team
7* 7*
8* Description: 8* Description:
9* 9*
10* This file contains utilities for check_tcp. These are tested by libtap 10* This file contains utilities for check_tcp. These are tested by libtap
11* 11*
12* 12*
13* This program is free software: you can redistribute it and/or modify 13* This program is free software: you can redistribute it and/or modify
14* it under the terms of the GNU General Public License as published by 14* it under the terms of the GNU General Public License as published by
15* the Free Software Foundation, either version 3 of the License, or 15* the Free Software Foundation, either version 3 of the License, or
16* (at your option) any later version. 16* (at your option) any later version.
17* 17*
18* This program is distributed in the hope that it will be useful, 18* This program is distributed in the hope that it will be useful,
19* but WITHOUT ANY WARRANTY; without even the implied warranty of 19* but WITHOUT ANY WARRANTY; without even the implied warranty of
20* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21* GNU General Public License for more details. 21* GNU General Public License for more details.
22* 22*
23* You should have received a copy of the GNU General Public License 23* You should have received a copy of the GNU General Public License
24* along with this program. If not, see <http://www.gnu.org/licenses/>. 24* along with this program. If not, see <http://www.gnu.org/licenses/>.
25* 25*
26* 26*
27*****************************************************************************/ 27*****************************************************************************/
28 28
29#include "common.h" 29#include "common.h"