diff options
Diffstat (limited to 'plugins/check_snmp.c')
| -rw-r--r-- | plugins/check_snmp.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c index 1746fd79..2b3099c9 100644 --- a/plugins/check_snmp.c +++ b/plugins/check_snmp.c | |||
| @@ -256,7 +256,10 @@ int main(int argc, char **argv) { | |||
| 256 | 256 | ||
| 257 | timeout_interval = DEFAULT_SOCKET_TIMEOUT; | 257 | timeout_interval = DEFAULT_SOCKET_TIMEOUT; |
| 258 | 258 | ||
| 259 | 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); | ||
| 260 | 263 | ||
| 261 | state_key stateKey = np_enable_state(NULL, 1, progname, argc, argv); | 264 | state_key stateKey = np_enable_state(NULL, 1, progname, argc, argv); |
| 262 | 265 | ||
| @@ -447,7 +450,7 @@ static process_arguments_wrapper process_arguments(int argc, char **argv) { | |||
| 447 | argc, argv, | 450 | argc, argv, |
| 448 | "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); |
| 449 | 452 | ||
| 450 | if (option_char == -1 || option_char == EOF) { | 453 | if (CHECK_EOF(option_char)) { |
| 451 | break; | 454 | break; |
| 452 | } | 455 | } |
| 453 | 456 | ||
| @@ -508,8 +511,8 @@ static process_arguments_wrapper process_arguments(int argc, char **argv) { | |||
| 508 | unsigned char *privpasswd = NULL; | 511 | unsigned char *privpasswd = NULL; |
| 509 | int cflags = REG_EXTENDED | REG_NOSUB | REG_NEWLINE; | 512 | int cflags = REG_EXTENDED | REG_NOSUB | REG_NEWLINE; |
| 510 | char *port = NULL; | 513 | char *port = NULL; |
| 511 | char *miblist = NULL; | 514 | const char *miblist = NULL; |
| 512 | char *connection_prefix = NULL; | 515 | const char *connection_prefix = NULL; |
| 513 | bool snmp_version_set_explicitely = false; | 516 | bool snmp_version_set_explicitely = false; |
| 514 | // TODO error checking | 517 | // TODO error checking |
| 515 | while (true) { | 518 | while (true) { |
| @@ -517,7 +520,7 @@ static process_arguments_wrapper process_arguments(int argc, char **argv) { | |||
| 517 | argc, argv, | 520 | argc, argv, |
| 518 | "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); |
| 519 | 522 | ||
| 520 | if (option_char == -1 || option_char == EOF) { | 523 | if (CHECK_EOF(option_char)) { |
| 521 | break; | 524 | break; |
| 522 | } | 525 | } |
| 523 | 526 | ||
