summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2002-09-11 18:12:29 +0000
committerpeter <peter@FreeBSD.org>2002-09-11 18:12:29 +0000
commit117de6ded03771c520cfbb30e890688da1a0d467 (patch)
tree7c54d5730cf8a8219272bf47e8768939ca392cdd
parent2a63985c692979ff208ce09884ce36db7752beed (diff)
downloadFreeBSD-src-117de6ded03771c520cfbb30e890688da1a0d467.zip
FreeBSD-src-117de6ded03771c520cfbb30e890688da1a0d467.tar.gz
Modify previous commit to solve the real problem that made gcc think
the timestamp was aligned. ie: Use a void * instead of struct timeval * which gcc assumes will be aligned. Go back to memcpy(). Submitted by: bde
-rw-r--r--sbin/ping/ping.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c
index 0889122..3b8db2a 100644
--- a/sbin/ping/ping.c
+++ b/sbin/ping/ping.c
@@ -811,7 +811,7 @@ pr_pack(buf, cc, from, tv)
struct icmp *icp;
struct ip *ip;
struct in_addr ina;
- struct timeval *tp;
+ const void *tp;
u_char *cp, *dp;
double triptime;
int dupflag, hlen, i, j, seq;
@@ -839,12 +839,12 @@ pr_pack(buf, cc, from, tv)
if (timing) {
struct timeval tv1;
#ifndef icmp_data
- tp = (struct timeval *)&icp->icmp_ip;
+ tp = &icp->icmp_ip;
#else
- tp = (struct timeval *)icp->icmp_data;
+ tp = icp->icmp_data;
#endif
- /* Avoid unaligned data (cannot use memcpy) */
- bcopy(tp, &tv1, sizeof(tv1));
+ /* Copy to avoid alignment problems: */
+ memcpy(&tv1, tp, sizeof(tv1));
tvsub(tv, &tv1);
triptime = ((double)tv->tv_sec) * 1000.0 +
((double)tv->tv_usec) / 1000.0;
OpenPOWER on IntegriCloud