summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Weiss <hweiss@users.sourceforge.net>2008-01-08 01:43:49 +0000
committerHolger Weiss <hweiss@users.sourceforge.net>2008-01-08 01:43:49 +0000
commit5da79db21aa37e2663662f96ff328ce127db25e0 (patch)
tree215ab504391fcab80868dfd71f6469a7ff892bd5
parentaa215f26d9617c9c63f82ab690641fa99f1471b1 (diff)
downloadmonitoring-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.c4
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)
1139{ 1139{
1140#if defined(SIOCGIFADDR) 1140#if defined(SIOCGIFADDR)
1141 struct ifreq ifr; 1141 struct ifreq ifr;
1142 struct sockaddr_in ip;
1142 1143
1143 strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name) - 1); 1144 strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name) - 1);
1144 ifr.ifr_name[sizeof(ifr.ifr_name) - 1] = '\0'; 1145 ifr.ifr_name[sizeof(ifr.ifr_name) - 1] = '\0';
1145 if(ioctl(icmp_sock, SIOCGIFADDR, &ifr) == -1) 1146 if(ioctl(icmp_sock, SIOCGIFADDR, &ifr) == -1)
1146 crash("Cannot determine IP address of interface %s", ifname); 1147 crash("Cannot determine IP address of interface %s", ifname);
1147 return ((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr.s_addr; 1148 memcpy(&ip, &ifr.ifr_addr, sizeof(ip));
1149 return ip.sin_addr.s_addr;
1148#else 1150#else
1149 errno = 0; 1151 errno = 0;
1150 crash("Cannot get interface IP address on this platform."); 1152 crash("Cannot get interface IP address on this platform.");