summaryrefslogtreecommitdiffstats
path: root/plugins-root
diff options
context:
space:
mode:
authorRincewindsHat <12514511+RincewindsHat@users.noreply.github.com>2023-02-19 14:31:21 +0100
committerRincewindsHat <12514511+RincewindsHat@users.noreply.github.com>2023-02-19 14:31:21 +0100
commitd3a4bad51d72a3c5bcc06ceb5e0a823dcc24bf49 (patch)
treef76b6afec71996f1a384afa0c8282a99bfbac584 /plugins-root
parent9a73a94258689cd9337fe7a7937fe85e4670aaeb (diff)
downloadmonitoring-plugins-d3a4bad51d72a3c5bcc06ceb5e0a823dcc24bf49.tar.gz
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.
Diffstat (limited to 'plugins-root')
-rw-r--r--plugins-root/check_icmp.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/plugins-root/check_icmp.c b/plugins-root/check_icmp.c
index 7f3c4b5b..317cd535 100644
--- a/plugins-root/check_icmp.c
+++ b/plugins-root/check_icmp.c
@@ -1430,20 +1430,21 @@ set_source_ip(char *arg)
1430static in_addr_t 1430static in_addr_t
1431get_ip_address(const char *ifname) 1431get_ip_address(const char *ifname)
1432{ 1432{
1433 // TODO: Rewrite this so the function return an error and we exit somewhere else
1434 struct sockaddr_in ip;
1433#if defined(SIOCGIFADDR) 1435#if defined(SIOCGIFADDR)
1434 struct ifreq ifr; 1436 struct ifreq ifr;
1435 struct sockaddr_in ip;
1436 1437
1437 strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name) - 1); 1438 strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name) - 1);
1438 ifr.ifr_name[sizeof(ifr.ifr_name) - 1] = '\0'; 1439 ifr.ifr_name[sizeof(ifr.ifr_name) - 1] = '\0';
1439 if(ioctl(icmp_sock, SIOCGIFADDR, &ifr) == -1) 1440 if(ioctl(icmp_sock, SIOCGIFADDR, &ifr) == -1)
1440 crash("Cannot determine IP address of interface %s", ifname); 1441 crash("Cannot determine IP address of interface %s", ifname);
1441 memcpy(&ip, &ifr.ifr_addr, sizeof(ip)); 1442 memcpy(&ip, &ifr.ifr_addr, sizeof(ip));
1442 return ip.sin_addr.s_addr;
1443#else 1443#else
1444 errno = 0; 1444 errno = 0;
1445 crash("Cannot get interface IP address on this platform."); 1445 crash("Cannot get interface IP address on this platform.");
1446#endif 1446#endif
1447 return ip.sin_addr.s_addr;
1447} 1448}
1448 1449
1449/* 1450/*