From d3a4bad51d72a3c5bcc06ceb5e0a823dcc24bf49 Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Sun, 19 Feb 2023 14:31:21 +0100 Subject: 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. diff --git a/plugins-root/check_icmp.c b/plugins-root/check_icmp.c index 7f3c4b5..317cd53 100644 --- a/plugins-root/check_icmp.c +++ b/plugins-root/check_icmp.c @@ -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; } /* -- cgit v0.10-9-g596f