mirror of
https://github.com/monitoring-plugins/monitoring-plugins.git
synced 2026-05-28 04:35:40 -04:00
check_icmp: Fix compiler warning
This fixes a compiler warning with no real world impact. The compiler complains about a missing return, which is correct, but in that scenario the program would crash anyways, so this has no impact.
This commit is contained in:
parent
9a73a94258
commit
d3a4bad51d
1 changed files with 3 additions and 2 deletions
|
|
@ -1430,20 +1430,21 @@ set_source_ip(char *arg)
|
|||
static in_addr_t
|
||||
get_ip_address(const char *ifname)
|
||||
{
|
||||
// TODO: Rewrite this so the function return an error and we exit somewhere else
|
||||
struct sockaddr_in ip;
|
||||
#if defined(SIOCGIFADDR)
|
||||
struct ifreq ifr;
|
||||
struct sockaddr_in ip;
|
||||
|
||||
strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name) - 1);
|
||||
ifr.ifr_name[sizeof(ifr.ifr_name) - 1] = '\0';
|
||||
if(ioctl(icmp_sock, SIOCGIFADDR, &ifr) == -1)
|
||||
crash("Cannot determine IP address of interface %s", ifname);
|
||||
memcpy(&ip, &ifr.ifr_addr, sizeof(ip));
|
||||
return ip.sin_addr.s_addr;
|
||||
#else
|
||||
errno = 0;
|
||||
crash("Cannot get interface IP address on this platform.");
|
||||
#endif
|
||||
return ip.sin_addr.s_addr;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in a new issue