diff options
Diffstat (limited to 'plugins-root/check_icmp.c')
| -rw-r--r-- | plugins-root/check_icmp.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/plugins-root/check_icmp.c b/plugins-root/check_icmp.c index 5bfb5cb5..e536e31c 100644 --- a/plugins-root/check_icmp.c +++ b/plugins-root/check_icmp.c | |||
| @@ -277,15 +277,6 @@ typedef struct { | |||
| 277 | check_icmp_config config; | 277 | check_icmp_config config; |
| 278 | } check_icmp_config_wrapper; | 278 | } check_icmp_config_wrapper; |
| 279 | check_icmp_config_wrapper process_arguments(int argc, char **argv) { | 279 | check_icmp_config_wrapper process_arguments(int argc, char **argv) { |
| 280 | /* get calling name the old-fashioned way for portability instead | ||
| 281 | * of relying on the glibc-ism __progname */ | ||
| 282 | char *ptr = strrchr(argv[0], '/'); | ||
| 283 | if (ptr) { | ||
| 284 | progname = &ptr[1]; | ||
| 285 | } else { | ||
| 286 | progname = argv[0]; | ||
| 287 | } | ||
| 288 | |||
| 289 | check_icmp_config_wrapper result = { | 280 | check_icmp_config_wrapper result = { |
| 290 | .errorcode = OK, | 281 | .errorcode = OK, |
| 291 | .config = check_icmp_config_init(), | 282 | .config = check_icmp_config_init(), |
| @@ -828,6 +819,14 @@ int main(int argc, char **argv) { | |||
| 828 | /* POSIXLY_CORRECT might break things, so unset it (the portable way) */ | 819 | /* POSIXLY_CORRECT might break things, so unset it (the portable way) */ |
| 829 | environ = NULL; | 820 | environ = NULL; |
| 830 | 821 | ||
| 822 | /* determine program- and service-name quickly */ | ||
| 823 | progname = strrchr(argv[0], '/'); | ||
| 824 | if (progname != NULL) { | ||
| 825 | progname++; | ||
| 826 | } else { | ||
| 827 | progname = argv[0]; | ||
| 828 | } | ||
| 829 | |||
| 831 | /* Parse extra opts if any */ | 830 | /* Parse extra opts if any */ |
| 832 | argv = np_extra_opts(&argc, argv, progname); | 831 | argv = np_extra_opts(&argc, argv, progname); |
| 833 | 832 | ||
