- remake type conversions to gcc4.4 requirements

This commit is contained in:
Jiri Skala 2009-02-25 21:59:39 +00:00
parent e0d49a8f5a
commit 937f3e92ec
2 changed files with 94 additions and 1 deletions

View File

@ -0,0 +1,88 @@
diff -up iputils-s20071127/ping6.c.corr_type iputils-s20071127/ping6.c
--- iputils-s20071127/ping6.c.corr_type 2009-02-16 14:47:29.000000000 +0100
+++ iputils-s20071127/ping6.c 2009-02-18 09:12:46.000000000 +0100
@@ -775,7 +775,7 @@ parse_reply(struct msghdr *msg, int cc,
#endif
if (c->cmsg_len < CMSG_LEN(sizeof(int)))
continue;
- hops = *(int*)CMSG_DATA(c);
+ memcpy(&hops, CMSG_DATA(c), sizeof (int));
}
}
diff -up iputils-s20071127/ping.c.corr_type iputils-s20071127/ping.c
--- iputils-s20071127/ping.c.corr_type 2009-02-16 13:58:38.000000000 +0100
+++ iputils-s20071127/ping.c 2009-02-16 14:22:49.000000000 +0100
@@ -1193,18 +1193,20 @@ pr_addr(__u32 addr)
struct hostent *hp;
static char buf[4096];
static __u32 addr_cache = 0;
+ struct in_addr tmp_addr;
if ( addr == addr_cache )
return buf;
addr_cache = addr;
+ tmp_addr.s_addr = addr;
if ((options & F_NUMERIC) ||
!(hp = gethostbyaddr((char *)&addr, 4, AF_INET)))
- sprintf(buf, "%s", inet_ntoa(*(struct in_addr *)&addr));
+ sprintf(buf, "%s", inet_ntoa(tmp_addr));
else
snprintf(buf, sizeof(buf), "%s (%s)", hp->h_name,
- inet_ntoa(*(struct in_addr *)&addr));
+ inet_ntoa(tmp_addr));
return(buf);
}
diff -up iputils-s20071127/rdisc.c.corr_type iputils-s20071127/rdisc.c
--- iputils-s20071127/rdisc.c.corr_type 2009-02-18 11:04:14.000000000 +0100
+++ iputils-s20071127/rdisc.c 2009-02-18 13:32:41.000000000 +0100
@@ -1476,14 +1476,19 @@ rtioctl(struct in_addr addr, int op)
{
int sock;
struct rtentry rt;
- struct sockaddr_in *sin;
+ union {
+ struct sockaddr *sa;
+ struct sockaddr_in *sin;
+ } conv;
memset((char *)&rt, 0, sizeof(struct rtentry));
rt.rt_dst.sa_family = AF_INET;
rt.rt_gateway.sa_family = AF_INET;
rt.rt_genmask.sa_family = AF_INET;
- sin = (struct sockaddr_in *)ALLIGN(&rt.rt_gateway);
- sin->sin_addr = addr;
+ // gcc4.4 hack
+ conv.sa = ALLIGN(&rt.rt_gateway);
+ memcpy(&conv.sin->sin_addr, &addr, sizeof(struct in_addr));
+ // -----------
rt.rt_flags = RTF_UP | RTF_GATEWAY;
sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
diff -up iputils-s20071127/tracepath6.c.corr_type iputils-s20071127/tracepath6.c
--- iputils-s20071127/tracepath6.c.corr_type 2009-02-18 13:57:54.000000000 +0100
+++ iputils-s20071127/tracepath6.c 2009-02-18 13:58:47.000000000 +0100
@@ -126,7 +126,7 @@ restart:
#ifdef IPV6_2292HOPLIMIT
case IPV6_2292HOPLIMIT:
#endif
- rethops = *(int*)CMSG_DATA(cmsg);
+ memcpy(&rethops, CMSG_DATA(cmsg), sizeof (int));
break;
}
} else if (cmsg->cmsg_level == SOL_IP) {
diff -up iputils-s20071127/tracepath.c.corr_type iputils-s20071127/tracepath.c
--- iputils-s20071127/tracepath.c.corr_type 2009-02-18 13:53:20.000000000 +0100
+++ iputils-s20071127/tracepath.c 2009-02-18 13:50:24.000000000 +0100
@@ -128,7 +128,7 @@ restart:
if (cmsg->cmsg_type == IP_RECVERR) {
e = (struct sock_extended_err *) CMSG_DATA(cmsg);
} else if (cmsg->cmsg_type == IP_TTL) {
- rethops = *(int*)CMSG_DATA(cmsg);
+ memcpy(&rethops, CMSG_DATA(cmsg), sizeof(int));
} else {
printf("cmsg:%d\n ", cmsg->cmsg_type);
}

View File

@ -1,7 +1,7 @@
Summary: Network monitoring tools including ping
Name: iputils
Version: 20071127
Release: 7%{?dist}
Release: 8%{?dist}
License: BSD
URL: http://www.skbuff.net/iputils
Group: System Environment/Daemons
@ -25,6 +25,7 @@ Patch11: iputils-20071127-output.patch
Patch12: iputils-20070202-ia64_align.patch
Patch13: iputils-20071127-warnings.patch
Patch14: iputils-20071127-typing_bug.patch
Patch15: iputils-20071127-corr_type.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: docbook-utils perl-SGMLSpm
@ -59,6 +60,7 @@ the target machine is alive and receiving network traffic.
%patch12 -p1 -b .ia64_align
%patch13 -p1 -b .warnings
%patch14 -p1 -b .typing_bug
%patch15 -p1 -b .corr_type
%build
%ifarch s390 s390x
@ -148,6 +150,9 @@ rm -rf ${RPM_BUILD_ROOT}
%{_sysconfdir}/rc.d/init.d/rdisc
%changelog
* Wed Feb 25 2009 Jiri Skala <jskala@redhat.com> - 20071127-8
- remake type conversions to gcc4.4 requirements
* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 20071127-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild