diff options
author | Holger Weiss <hweiss@users.sourceforge.net> | 2008-01-08 01:43:49 +0000 |
---|---|---|
committer | Holger Weiss <hweiss@users.sourceforge.net> | 2008-01-08 01:43:49 +0000 |
commit | 5da79db21aa37e2663662f96ff328ce127db25e0 (patch) | |
tree | 215ab504391fcab80868dfd71f6469a7ff892bd5 | |
parent | aa215f26d9617c9c63f82ab690641fa99f1471b1 (diff) | |
download | monitoring-plugins-5da79db21aa37e2663662f96ff328ce127db25e0.tar.gz |
Get rid of a cast which increases the required alignment.
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1895 f882894a-f735-0410-b71e-b25c423dba1c
-rw-r--r-- | plugins-root/check_icmp.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/plugins-root/check_icmp.c b/plugins-root/check_icmp.c index 700fe8b6..c0b29f25 100644 --- a/plugins-root/check_icmp.c +++ b/plugins-root/check_icmp.c @@ -1139,12 +1139,14 @@ get_ip_address(const char *ifname) { #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); - return ((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr.s_addr; + 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."); |