diff options
Diffstat (limited to 'plugins-root/check_icmp.c')
-rw-r--r-- | plugins-root/check_icmp.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/plugins-root/check_icmp.c b/plugins-root/check_icmp.c index 9ceb35b2..edfd6949 100644 --- a/plugins-root/check_icmp.c +++ b/plugins-root/check_icmp.c | |||
@@ -1436,11 +1436,15 @@ get_ip_address(const char *ifname) | |||
1436 | struct ifreq ifr; | 1436 | struct ifreq ifr; |
1437 | 1437 | ||
1438 | strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name) - 1); | 1438 | strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name) - 1); |
1439 | |||
1439 | ifr.ifr_name[sizeof(ifr.ifr_name) - 1] = '\0'; | 1440 | ifr.ifr_name[sizeof(ifr.ifr_name) - 1] = '\0'; |
1441 | |||
1440 | if(ioctl(icmp_sock, SIOCGIFADDR, &ifr) == -1) | 1442 | if(ioctl(icmp_sock, SIOCGIFADDR, &ifr) == -1) |
1441 | crash("Cannot determine IP address of interface %s", ifname); | 1443 | crash("Cannot determine IP address of interface %s", ifname); |
1444 | |||
1442 | memcpy(&ip, &ifr.ifr_addr, sizeof(ip)); | 1445 | memcpy(&ip, &ifr.ifr_addr, sizeof(ip)); |
1443 | #else | 1446 | #else |
1447 | (void) ifname; | ||
1444 | errno = 0; | 1448 | errno = 0; |
1445 | crash("Cannot get interface IP address on this platform."); | 1449 | crash("Cannot get interface IP address on this platform."); |
1446 | #endif | 1450 | #endif |