summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Makefile.am2
-rw-r--r--plugins/check_cluster.c2
-rw-r--r--plugins/check_curl.c2
-rw-r--r--plugins/check_dig.c2
-rw-r--r--plugins/check_disk.c2
-rw-r--r--plugins/check_fping.c2
-rw-r--r--plugins/check_game.c2
-rw-r--r--plugins/check_hpjd.c2
-rw-r--r--plugins/check_ide_smart.c2
-rw-r--r--plugins/check_ldap.c2
-rw-r--r--plugins/check_load.c2
-rw-r--r--plugins/check_mysql.c2
-rw-r--r--plugins/check_nagios.c2
-rw-r--r--plugins/check_ping.c2
-rw-r--r--plugins/check_procs.c2
-rw-r--r--plugins/check_radius.c2
-rw-r--r--plugins/check_real.d/config.h2
-rw-r--r--plugins/check_snmp.c15
-rw-r--r--plugins/check_snmp.d/check_snmp_helpers.c19
-rw-r--r--plugins/check_tcp.c2
-rw-r--r--plugins/check_time.c2
-rw-r--r--plugins/common.h9
-rw-r--r--plugins/utils.h1
23 files changed, 50 insertions, 32 deletions
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index a35f273e..9aefcea0 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -166,7 +166,7 @@ check_real_LDADD = $(NETLIBS)
166check_snmp_SOURCES = check_snmp.c check_snmp.d/check_snmp_helpers.c 166check_snmp_SOURCES = check_snmp.c check_snmp.d/check_snmp_helpers.c
167check_snmp_LDADD = $(BASEOBJS) 167check_snmp_LDADD = $(BASEOBJS)
168check_snmp_LDFLAGS = $(AM_LDFLAGS) -lm `net-snmp-config --libs` 168check_snmp_LDFLAGS = $(AM_LDFLAGS) -lm `net-snmp-config --libs`
169check_snmp_CFLAGS = $(AM_CFLAGS) `net-snmp-config --cflags` 169check_snmp_CFLAGS = $(AM_CFLAGS) `net-snmp-config --cflags | sed 's/-Werror=declaration-after-statement//' | sed 's/-Wundef//'`
170check_smtp_LDADD = $(SSLOBJS) 170check_smtp_LDADD = $(SSLOBJS)
171check_ssh_LDADD = $(NETLIBS) 171check_ssh_LDADD = $(NETLIBS)
172check_swap_SOURCES = check_swap.c check_swap.d/swap.c 172check_swap_SOURCES = check_swap.c check_swap.d/swap.c
diff --git a/plugins/check_cluster.c b/plugins/check_cluster.c
index 1cbdcd60..92c3827a 100644
--- a/plugins/check_cluster.c
+++ b/plugins/check_cluster.c
@@ -175,7 +175,7 @@ check_cluster_config_wrapper process_arguments(int argc, char **argv) {
175 while (true) { 175 while (true) {
176 int option_index = getopt_long(argc, argv, "hHsvVw:c:d:l:", longopts, &option); 176 int option_index = getopt_long(argc, argv, "hHsvVw:c:d:l:", longopts, &option);
177 177
178 if (option_index == -1 || option_index == EOF || option_index == 1) { 178 if (CHECK_EOF(option_index) || option_index == 1) {
179 break; 179 break;
180 } 180 }
181 181
diff --git a/plugins/check_curl.c b/plugins/check_curl.c
index 1dec8a2a..0bc5f9b0 100644
--- a/plugins/check_curl.c
+++ b/plugins/check_curl.c
@@ -946,7 +946,7 @@ check_curl_config_wrapper process_arguments(int argc, char **argv) {
946 int option_index = getopt_long( 946 int option_index = getopt_long(
947 argc, argv, "Vvh46t:c:w:A:k:H:P:j:T:I:a:b:d:e:p:s:R:r:u:f:C:J:K:DnlLS::m:M:NEB", 947 argc, argv, "Vvh46t:c:w:A:k:H:P:j:T:I:a:b:d:e:p:s:R:r:u:f:C:J:K:DnlLS::m:M:NEB",
948 longopts, &option); 948 longopts, &option);
949 if (option_index == -1 || option_index == EOF || option_index == 1) { 949 if (CHECK_EOF(option_index) || option_index == 1) {
950 break; 950 break;
951 } 951 }
952 952
diff --git a/plugins/check_dig.c b/plugins/check_dig.c
index 9ea19e6a..9ec8028a 100644
--- a/plugins/check_dig.c
+++ b/plugins/check_dig.c
@@ -284,7 +284,7 @@ check_dig_config_wrapper process_arguments(int argc, char **argv) {
284 int option_index = 284 int option_index =
285 getopt_long(argc, argv, "hVvt:l:H:w:c:T:p:a:A:E:X:46", longopts, &option); 285 getopt_long(argc, argv, "hVvt:l:H:w:c:T:p:a:A:E:X:46", longopts, &option);
286 286
287 if (option_index == -1 || option_index == EOF) { 287 if (CHECK_EOF(option_index)) {
288 break; 288 break;
289 } 289 }
290 290
diff --git a/plugins/check_disk.c b/plugins/check_disk.c
index e1a2baff..4ec1b211 100644
--- a/plugins/check_disk.c
+++ b/plugins/check_disk.c
@@ -448,7 +448,7 @@ check_disk_config_wrapper process_arguments(int argc, char **argv) {
448 int option_index = getopt_long( 448 int option_index = getopt_long(
449 argc, argv, "+?VqhvefCt:c:w:K:W:u:p:x:X:N:mklLPg:R:r:i:I:MEAn", longopts, &option); 449 argc, argv, "+?VqhvefCt:c:w:K:W:u:p:x:X:N:mklLPg:R:r:i:I:MEAn", longopts, &option);
450 450
451 if (option_index == -1 || option_index == EOF) { 451 if (CHECK_EOF(option_index)) {
452 break; 452 break;
453 } 453 }
454 454
diff --git a/plugins/check_fping.c b/plugins/check_fping.c
index 6160c2cb..86ef64a4 100644
--- a/plugins/check_fping.c
+++ b/plugins/check_fping.c
@@ -361,7 +361,7 @@ check_fping_config_wrapper process_arguments(int argc, char **argv) {
361 int option_index = 361 int option_index =
362 getopt_long(argc, argv, "+hVvaH:S:c:w:b:n:T:i:I:M:R:46", longopts, &option); 362 getopt_long(argc, argv, "+hVvaH:S:c:w:b:n:T:i:I:M:R:46", longopts, &option);
363 363
364 if (option_index == -1 || option_index == EOF || option_index == 1) { 364 if (CHECK_EOF(option_index) || option_index == 1) {
365 break; 365 break;
366 } 366 }
367 367
diff --git a/plugins/check_game.c b/plugins/check_game.c
index 974a7253..48ec6883 100644
--- a/plugins/check_game.c
+++ b/plugins/check_game.c
@@ -186,7 +186,7 @@ check_game_config_wrapper process_arguments(int argc, char **argv) {
186 while (true) { 186 while (true) {
187 int option_index = getopt_long(argc, argv, "hVvt:H:P:G:g:p:m:", long_opts, &opt_index); 187 int option_index = getopt_long(argc, argv, "hVvt:H:P:G:g:p:m:", long_opts, &opt_index);
188 188
189 if (option_index == -1 || option_index == EOF) { 189 if (CHECK_EOF(option_index)) {
190 break; 190 break;
191 } 191 }
192 192
diff --git a/plugins/check_hpjd.c b/plugins/check_hpjd.c
index 9907abc5..883f1df0 100644
--- a/plugins/check_hpjd.c
+++ b/plugins/check_hpjd.c
@@ -299,7 +299,7 @@ check_hpjd_config_wrapper process_arguments(int argc, char **argv) {
299 while (true) { 299 while (true) {
300 int option_index = getopt_long(argc, argv, "+hVH:C:p:D", longopts, &option); 300 int option_index = getopt_long(argc, argv, "+hVH:C:p:D", longopts, &option);
301 301
302 if (option_index == -1 || option_index == EOF || option_index == 1) { 302 if (CHECK_EOF(option_index) || option_index == 1) {
303 break; 303 break;
304 } 304 }
305 305
diff --git a/plugins/check_ide_smart.c b/plugins/check_ide_smart.c
index c1325cf9..43731039 100644
--- a/plugins/check_ide_smart.c
+++ b/plugins/check_ide_smart.c
@@ -169,7 +169,7 @@ static check_ide_smart_config_wrapper process_arguments(int argc, char **argv) {
169 int longindex = 0; 169 int longindex = 0;
170 int option_index = getopt_long(argc, argv, "+d:iq10nhVv", longopts, &longindex); 170 int option_index = getopt_long(argc, argv, "+d:iq10nhVv", longopts, &longindex);
171 171
172 if (option_index == -1 || option_index == EOF || option_index == 1) { 172 if (CHECK_EOF(option_index) || option_index == 1) {
173 break; 173 break;
174 } 174 }
175 175
diff --git a/plugins/check_ldap.c b/plugins/check_ldap.c
index 1b2e2826..300a0dc1 100644
--- a/plugins/check_ldap.c
+++ b/plugins/check_ldap.c
@@ -362,7 +362,7 @@ check_ldap_config_wrapper process_arguments(int argc, char **argv) {
362 int option_index = 362 int option_index =
363 getopt_long(argc, argv, "hvV234TS6t:c:w:H:b:p:a:D:P:C:W:", longopts, &option); 363 getopt_long(argc, argv, "hvV234TS6t:c:w:H:b:p:a:D:P:C:W:", longopts, &option);
364 364
365 if (option_index == -1 || option_index == EOF) { 365 if (CHECK_EOF(option_index)) {
366 break; 366 break;
367 } 367 }
368 368
diff --git a/plugins/check_load.c b/plugins/check_load.c
index 644cd604..60fa646f 100644
--- a/plugins/check_load.c
+++ b/plugins/check_load.c
@@ -295,7 +295,7 @@ static check_load_config_wrapper process_arguments(int argc, char **argv) {
295 int option = 0; 295 int option = 0;
296 int option_index = getopt_long(argc, argv, "Vhrc:w:n:", longopts, &option); 296 int option_index = getopt_long(argc, argv, "Vhrc:w:n:", longopts, &option);
297 297
298 if (option_index == -1 || option_index == EOF) { 298 if (CHECK_EOF(option_index)) {
299 break; 299 break;
300 } 300 }
301 301
diff --git a/plugins/check_mysql.c b/plugins/check_mysql.c
index 26730d4c..20b4ac3f 100644
--- a/plugins/check_mysql.c
+++ b/plugins/check_mysql.c
@@ -504,7 +504,7 @@ check_mysql_config_wrapper process_arguments(int argc, char **argv) {
504 int option_index = 504 int option_index =
505 getopt_long(argc, argv, "hlvVnSP:p:u:d:H:s:c:w:a:k:C:D:L:f:g:", longopts, &option); 505 getopt_long(argc, argv, "hlvVnSP:p:u:d:H:s:c:w:a:k:C:D:L:f:g:", longopts, &option);
506 506
507 if (option_index == -1 || option_index == EOF) { 507 if (CHECK_EOF(option_index)) {
508 break; 508 break;
509 } 509 }
510 510
diff --git a/plugins/check_nagios.c b/plugins/check_nagios.c
index a46dc1ed..e2f230c9 100644
--- a/plugins/check_nagios.c
+++ b/plugins/check_nagios.c
@@ -227,7 +227,7 @@ check_nagios_config_wrapper process_arguments(int argc, char **argv) {
227 while (true) { 227 while (true) {
228 int option_index = getopt_long(argc, argv, "+hVvF:C:e:t:", longopts, &option); 228 int option_index = getopt_long(argc, argv, "+hVvF:C:e:t:", longopts, &option);
229 229
230 if (option_index == -1 || option_index == EOF || option_index == 1) { 230 if (CHECK_EOF(option_index) || option_index == 1) {
231 break; 231 break;
232 } 232 }
233 233
diff --git a/plugins/check_ping.c b/plugins/check_ping.c
index 61feb958..cb9e8f57 100644
--- a/plugins/check_ping.c
+++ b/plugins/check_ping.c
@@ -221,7 +221,7 @@ check_ping_config_wrapper process_arguments(int argc, char **argv) {
221 while (true) { 221 while (true) {
222 int option_index = getopt_long(argc, argv, "VvhnL46t:c:w:H:p:", longopts, &option); 222 int option_index = getopt_long(argc, argv, "VvhnL46t:c:w:H:p:", longopts, &option);
223 223
224 if (option_index == -1 || option_index == EOF) { 224 if (CHECK_EOF(option_index)) {
225 break; 225 break;
226 } 226 }
227 227
diff --git a/plugins/check_procs.c b/plugins/check_procs.c
index ae6e9c23..01476504 100644
--- a/plugins/check_procs.c
+++ b/plugins/check_procs.c
@@ -432,7 +432,7 @@ check_procs_config_wrapper process_arguments(int argc, char **argv) {
432 int option_index = 432 int option_index =
433 getopt_long(argc, argv, "Vvhkt:c:w:p:s:u:C:a:z:r:m:P:T:X:", longopts, &option); 433 getopt_long(argc, argv, "Vvhkt:c:w:p:s:u:C:a:z:r:m:P:T:X:", longopts, &option);
434 434
435 if (option_index == -1 || option_index == EOF) { 435 if (CHECK_EOF(option_index)) {
436 break; 436 break;
437 } 437 }
438 438
diff --git a/plugins/check_radius.c b/plugins/check_radius.c
index 93352bcc..6e062ff8 100644
--- a/plugins/check_radius.c
+++ b/plugins/check_radius.c
@@ -332,7 +332,7 @@ check_radius_config_wrapper process_arguments(int argc, char **argv) {
332 int option = 0; 332 int option = 0;
333 int option_index = getopt_long(argc, argv, "+hVvH:P:F:u:p:n:N:t:r:e:", longopts, &option); 333 int option_index = getopt_long(argc, argv, "+hVvH:P:F:u:p:n:N:t:r:e:", longopts, &option);
334 334
335 if (option_index == -1 || option_index == EOF || option_index == 1) { 335 if (CHECK_EOF(option_index) || option_index == 1) {
336 break; 336 break;
337 } 337 }
338 338
diff --git a/plugins/check_real.d/config.h b/plugins/check_real.d/config.h
index 2d99ad49..314aff37 100644
--- a/plugins/check_real.d/config.h
+++ b/plugins/check_real.d/config.h
@@ -9,7 +9,7 @@ enum {
9 PORT = 554 9 PORT = 554
10}; 10};
11 11
12const char *default_expect = "RTSP/1."; 12char *default_expect = "RTSP/1.";
13 13
14typedef struct { 14typedef struct {
15 char *server_address; 15 char *server_address;
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index f470d222..2b3099c9 100644
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
@@ -116,6 +116,7 @@ gen_state_string_type gen_state_string(check_snmp_state_entry *entries, size_t n
116 break; 116 break;
117 case ASN_FLOAT: 117 case ASN_FLOAT:
118 printf("Type FLOAT\n"); 118 printf("Type FLOAT\n");
119 break;
119 case ASN_DOUBLE: 120 case ASN_DOUBLE:
120 printf("Type DOUBLE\n"); 121 printf("Type DOUBLE\n");
121 break; 122 break;
@@ -217,6 +218,7 @@ recover_state_data_type recover_state_data(char *state_string, idx_t state_strin
217 break; 218 break;
218 case ASN_FLOAT: 219 case ASN_FLOAT:
219 printf("Type FLOAT\n"); 220 printf("Type FLOAT\n");
221 break;
220 case ASN_DOUBLE: 222 case ASN_DOUBLE:
221 printf("Type DOUBLE\n"); 223 printf("Type DOUBLE\n");
222 break; 224 break;
@@ -254,7 +256,10 @@ int main(int argc, char **argv) {
254 256
255 timeout_interval = DEFAULT_SOCKET_TIMEOUT; 257 timeout_interval = DEFAULT_SOCKET_TIMEOUT;
256 258
257 np_init((char *)progname, argc, argv); 259 char progname_copy[256];
260 strncpy(progname_copy, progname, sizeof(progname_copy)-1);
261 progname_copy[255] = '\0';
262 np_init(progname_copy, argc, argv);
258 263
259 state_key stateKey = np_enable_state(NULL, 1, progname, argc, argv); 264 state_key stateKey = np_enable_state(NULL, 1, progname, argc, argv);
260 265
@@ -445,7 +450,7 @@ static process_arguments_wrapper process_arguments(int argc, char **argv) {
445 argc, argv, 450 argc, argv,
446 "nhvVO46t:c:w:H:C:o:e:E:d:D:s:t:R:r:l:u:p:m:P:N:L:U:a:x:A:X:M:f:z:", longopts, &option); 451 "nhvVO46t:c:w:H:C:o:e:E:d:D:s:t:R:r:l:u:p:m:P:N:L:U:a:x:A:X:M:f:z:", longopts, &option);
447 452
448 if (option_char == -1 || option_char == EOF) { 453 if (CHECK_EOF(option_char)) {
449 break; 454 break;
450 } 455 }
451 456
@@ -506,8 +511,8 @@ static process_arguments_wrapper process_arguments(int argc, char **argv) {
506 unsigned char *privpasswd = NULL; 511 unsigned char *privpasswd = NULL;
507 int cflags = REG_EXTENDED | REG_NOSUB | REG_NEWLINE; 512 int cflags = REG_EXTENDED | REG_NOSUB | REG_NEWLINE;
508 char *port = NULL; 513 char *port = NULL;
509 char *miblist = NULL; 514 const char *miblist = NULL;
510 char *connection_prefix = NULL; 515 const char *connection_prefix = NULL;
511 bool snmp_version_set_explicitely = false; 516 bool snmp_version_set_explicitely = false;
512 // TODO error checking 517 // TODO error checking
513 while (true) { 518 while (true) {
@@ -515,7 +520,7 @@ static process_arguments_wrapper process_arguments(int argc, char **argv) {
515 argc, argv, 520 argc, argv,
516 "nhvVO46t:c:w:H:C:o:e:E:d:D:s:t:R:r:l:u:p:m:P:N:L:U:a:x:A:X:M:f:z:", longopts, &option); 521 "nhvVO46t:c:w:H:C:o:e:E:d:D:s:t:R:r:l:u:p:m:P:N:L:U:a:x:A:X:M:f:z:", longopts, &option);
517 522
518 if (option_char == -1 || option_char == EOF) { 523 if (CHECK_EOF(option_char)) {
519 break; 524 break;
520 } 525 }
521 526
diff --git a/plugins/check_snmp.d/check_snmp_helpers.c b/plugins/check_snmp.d/check_snmp_helpers.c
index 2dfc88b5..d680678a 100644
--- a/plugins/check_snmp.d/check_snmp_helpers.c
+++ b/plugins/check_snmp.d/check_snmp_helpers.c
@@ -91,6 +91,8 @@ const char DEFAULT_OUTPUT_DELIMITER[] = " ";
91 91
92const int RANDOM_STATE_DATA_LENGTH_PREDICTION = 8192; 92const int RANDOM_STATE_DATA_LENGTH_PREDICTION = 8192;
93 93
94char community[100];
95
94check_snmp_config check_snmp_config_init() { 96check_snmp_config check_snmp_config_init() {
95 check_snmp_config tmp = { 97 check_snmp_config tmp = {
96 .snmp_params = 98 .snmp_params =
@@ -129,14 +131,17 @@ check_snmp_config check_snmp_config_init() {
129 tmp.snmp_params.snmp_session.retries = DEFAULT_RETRIES; 131 tmp.snmp_params.snmp_session.retries = DEFAULT_RETRIES;
130 tmp.snmp_params.snmp_session.version = DEFAULT_SNMP_VERSION; 132 tmp.snmp_params.snmp_session.version = DEFAULT_SNMP_VERSION;
131 tmp.snmp_params.snmp_session.securityLevel = SNMP_SEC_LEVEL_NOAUTH; 133 tmp.snmp_params.snmp_session.securityLevel = SNMP_SEC_LEVEL_NOAUTH;
132 tmp.snmp_params.snmp_session.community = (unsigned char *)"public"; 134 strcpy(community, "public");
133 tmp.snmp_params.snmp_session.community_len = strlen("public"); 135 tmp.snmp_params.snmp_session.community = (unsigned char *)community;
136 tmp.snmp_params.snmp_session.community_len = strlen(community);
134 return tmp; 137 return tmp;
135} 138}
136 139
137snmp_responces do_snmp_query(check_snmp_config_snmp_parameters parameters) { 140snmp_responces do_snmp_query(check_snmp_config_snmp_parameters parameters) {
138 if (parameters.ignore_mib_parsing_errors) { 141 if (parameters.ignore_mib_parsing_errors) {
139 char *opt_toggle_res = snmp_mib_toggle_options("e"); 142 char option_e[2];
143 option_e[0] = 'e'; option_e[1] = '\0';
144 char *opt_toggle_res = snmp_mib_toggle_options(option_e);
140 if (opt_toggle_res != NULL) { 145 if (opt_toggle_res != NULL) {
141 die(STATE_UNKNOWN, "Unable to disable MIB parsing errors"); 146 die(STATE_UNKNOWN, "Unable to disable MIB parsing errors");
142 } 147 }
@@ -436,7 +441,7 @@ check_snmp_evaluation evaluate_single_unit(response_value response,
436 } 441 }
437 } else { 442 } else {
438 // It's only a counter if we cont compute rate 443 // It's only a counter if we cont compute rate
439 pd_num_val.uom = "c"; 444 pd_num_val.uom = strdup("c");
440 pd_result_val = mp_create_pd_value(response.value.uIntVal); 445 pd_result_val = mp_create_pd_value(response.value.uIntVal);
441 } 446 }
442 break; 447 break;
@@ -476,7 +481,7 @@ check_snmp_evaluation evaluate_single_unit(response_value response,
476 pd_result_val = mp_create_pd_value(treated_value); 481 pd_result_val = mp_create_pd_value(treated_value);
477 482
478 if (response.type == ASN_COUNTER) { 483 if (response.type == ASN_COUNTER) {
479 pd_num_val.uom = "c"; 484 pd_num_val.uom = strdup("c");
480 } 485 }
481 } 486 }
482 487
@@ -820,7 +825,7 @@ state_data *np_state_read(state_key stateKey) {
820 * envvar NAGIOS_PLUGIN_STATE_DIRECTORY 825 * envvar NAGIOS_PLUGIN_STATE_DIRECTORY
821 * statically compiled shared state directory 826 * statically compiled shared state directory
822 */ 827 */
823char *_np_state_calculate_location_prefix(void) { 828static const char *_np_state_calculate_location_prefix(void) {
824 char *env_dir; 829 char *env_dir;
825 830
826 /* Do not allow passing MP_STATE_PATH in setuid plugins 831 /* Do not allow passing MP_STATE_PATH in setuid plugins
@@ -871,7 +876,7 @@ state_key np_enable_state(char *keyname, int expected_data_version, const char *
871 tmp_char++; 876 tmp_char++;
872 } 877 }
873 this_state->name = temp_keyname; 878 this_state->name = temp_keyname;
874 this_state->plugin_name = (char *)plugin_name; 879 this_state->plugin_name = strdup(plugin_name);
875 this_state->data_version = expected_data_version; 880 this_state->data_version = expected_data_version;
876 this_state->state_data = NULL; 881 this_state->state_data = NULL;
877 882
diff --git a/plugins/check_tcp.c b/plugins/check_tcp.c
index 09806373..ec334941 100644
--- a/plugins/check_tcp.c
+++ b/plugins/check_tcp.c
@@ -550,7 +550,7 @@ static check_tcp_config_wrapper process_arguments(int argc, char **argv, check_t
550 int option_index = 550 int option_index =
551 getopt_long(argc, argv, "+hVv46EAH:s:e:q:m:c:w:t:p:C:W:d:Sr:jD:M:", longopts, &option); 551 getopt_long(argc, argv, "+hVv46EAH:s:e:q:m:c:w:t:p:C:W:d:Sr:jD:M:", longopts, &option);
552 552
553 if (option_index == -1 || option_index == EOF || option_index == 1) { 553 if (CHECK_EOF(option_index) || option_index == 1) {
554 break; 554 break;
555 } 555 }
556 556
diff --git a/plugins/check_time.c b/plugins/check_time.c
index 99708ad3..aec995d4 100644
--- a/plugins/check_time.c
+++ b/plugins/check_time.c
@@ -213,7 +213,7 @@ check_time_config_wrapper process_arguments(int argc, char **argv) {
213 int option = 0; 213 int option = 0;
214 option_char = getopt_long(argc, argv, "hVH:w:c:W:C:p:t:u", longopts, &option); 214 option_char = getopt_long(argc, argv, "hVH:w:c:W:C:p:t:u", longopts, &option);
215 215
216 if (option_char == -1 || option_char == EOF) { 216 if (CHECK_EOF(option_char)) {
217 break; 217 break;
218 } 218 }
219 219
diff --git a/plugins/common.h b/plugins/common.h
index ef888d08..9d1434a3 100644
--- a/plugins/common.h
+++ b/plugins/common.h
@@ -193,7 +193,7 @@ enum {
193 */ 193 */
194#include "../gl/gettext.h" 194#include "../gl/gettext.h"
195#define _(String) gettext(String) 195#define _(String) gettext(String)
196#if !ENABLE_NLS 196#if !defined(ENABLE_NLS) || !ENABLE_NLS
197# undef textdomain 197# undef textdomain
198# define textdomain(Domainname) /* empty */ 198# define textdomain(Domainname) /* empty */
199# undef bindtextdomain 199# undef bindtextdomain
@@ -205,4 +205,11 @@ enum {
205# define __attribute__(x) /* do nothing */ 205# define __attribute__(x) /* do nothing */
206#endif 206#endif
207 207
208/* for checking the result of getopt_long */
209#if EOF == -1
210#define CHECK_EOF(c) ((c) == EOF)
211#else
212#define CHECK_EOF(c) ((c) == -1 || (c) == EOF)
213#endif
214
208#endif /* _COMMON_H_ */ 215#endif /* _COMMON_H_ */
diff --git a/plugins/utils.h b/plugins/utils.h
index 68ff1630..c1c921fb 100644
--- a/plugins/utils.h
+++ b/plugins/utils.h
@@ -13,6 +13,7 @@ in order to resist overflow attacks. In addition, a few functions are
13provided to standardize version and error reporting across the entire 13provided to standardize version and error reporting across the entire
14suite of plugins. */ 14suite of plugins. */
15 15
16#undef USE_OPENSSL // net-snmp defines USE_OPENSSL as NETSNMP_USE_OPENSSL in net-snmp-config.h
16#include "../config.h" 17#include "../config.h"
17#include <stdbool.h> 18#include <stdbool.h>
18#include <stdint.h> 19#include <stdint.h>