diff options
author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2023-09-07 16:10:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-07 16:10:33 +0200 |
commit | ab493d5515bd6dd8f844eb673b783479074263f8 (patch) | |
tree | 79dd312bb14b3839b7d68582932396772d0dd55a /plugins-root | |
parent | c5e90822d7db1db504e19007a7078d1fa09267f2 (diff) | |
parent | 15d7ca8eb1edec26a44d361b57e53831f5c765f7 (diff) | |
download | monitoring-plugins-ab493d5515bd6dd8f844eb673b783479074263f8.tar.gz |
Merge branch 'master' into compiler_warning_part_3
Diffstat (limited to 'plugins-root')
-rw-r--r-- | plugins-root/check_dhcp.c | 12 | ||||
-rw-r--r-- | plugins-root/check_icmp.c | 5 |
2 files changed, 11 insertions, 6 deletions
diff --git a/plugins-root/check_dhcp.c b/plugins-root/check_dhcp.c index 147db6b3..2d22619b 100644 --- a/plugins-root/check_dhcp.c +++ b/plugins-root/check_dhcp.c | |||
@@ -229,7 +229,7 @@ struct in_addr requested_address; | |||
229 | 229 | ||
230 | int process_arguments(int, char **); | 230 | int process_arguments(int, char **); |
231 | int call_getopt(int, char **); | 231 | int call_getopt(int, char **); |
232 | int validate_arguments(int, int); | 232 | int validate_arguments(int); |
233 | void print_usage(void); | 233 | void print_usage(void); |
234 | void print_help(void); | 234 | void print_help(void); |
235 | 235 | ||
@@ -1055,8 +1055,8 @@ int process_arguments(int argc, char **argv){ | |||
1055 | return ERROR; | 1055 | return ERROR; |
1056 | 1056 | ||
1057 | arg_index = call_getopt(argc,argv); | 1057 | arg_index = call_getopt(argc,argv); |
1058 | return validate_arguments(argc,arg_index); | 1058 | return validate_arguments(argc); |
1059 | } | 1059 | } |
1060 | 1060 | ||
1061 | 1061 | ||
1062 | 1062 | ||
@@ -1154,13 +1154,13 @@ int call_getopt(int argc, char **argv){ | |||
1154 | } | 1154 | } |
1155 | 1155 | ||
1156 | 1156 | ||
1157 | int validate_arguments(int argc, int arg_index){ | 1157 | int validate_arguments(int argc){ |
1158 | 1158 | ||
1159 | if(argc-optind > 0) | 1159 | if(argc - optind > 0) |
1160 | usage(_("Got unexpected non-option argument")); | 1160 | usage(_("Got unexpected non-option argument")); |
1161 | 1161 | ||
1162 | return OK; | 1162 | return OK; |
1163 | } | 1163 | } |
1164 | 1164 | ||
1165 | 1165 | ||
1166 | #if defined(__sun__) || defined(__solaris__) || defined(__hpux__) | 1166 | #if defined(__sun__) || defined(__solaris__) || defined(__hpux__) |
diff --git a/plugins-root/check_icmp.c b/plugins-root/check_icmp.c index 9ceb35b2..1d47e9fc 100644 --- a/plugins-root/check_icmp.c +++ b/plugins-root/check_icmp.c | |||
@@ -1432,15 +1432,20 @@ get_ip_address(const char *ifname) | |||
1432 | { | 1432 | { |
1433 | // TODO: Rewrite this so the function return an error and we exit somewhere else | 1433 | // TODO: Rewrite this so the function return an error and we exit somewhere else |
1434 | struct sockaddr_in ip; | 1434 | struct sockaddr_in ip; |
1435 | ip.sin_addr.s_addr = 0; // Fake initialization to make compiler happy | ||
1435 | #if defined(SIOCGIFADDR) | 1436 | #if defined(SIOCGIFADDR) |
1436 | struct ifreq ifr; | 1437 | struct ifreq ifr; |
1437 | 1438 | ||
1438 | strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name) - 1); | 1439 | strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name) - 1); |
1440 | |||
1439 | ifr.ifr_name[sizeof(ifr.ifr_name) - 1] = '\0'; | 1441 | ifr.ifr_name[sizeof(ifr.ifr_name) - 1] = '\0'; |
1442 | |||
1440 | if(ioctl(icmp_sock, SIOCGIFADDR, &ifr) == -1) | 1443 | if(ioctl(icmp_sock, SIOCGIFADDR, &ifr) == -1) |
1441 | crash("Cannot determine IP address of interface %s", ifname); | 1444 | crash("Cannot determine IP address of interface %s", ifname); |
1445 | |||
1442 | memcpy(&ip, &ifr.ifr_addr, sizeof(ip)); | 1446 | memcpy(&ip, &ifr.ifr_addr, sizeof(ip)); |
1443 | #else | 1447 | #else |
1448 | (void) ifname; | ||
1444 | errno = 0; | 1449 | errno = 0; |
1445 | crash("Cannot get interface IP address on this platform."); | 1450 | crash("Cannot get interface IP address on this platform."); |
1446 | #endif | 1451 | #endif |