diff options
author | jb <jb@FreeBSD.org> | 1998-06-06 23:33:28 +0000 |
---|---|---|
committer | jb <jb@FreeBSD.org> | 1998-06-06 23:33:28 +0000 |
commit | e886c0d520510b5802f18292d53cd24fd79280a7 (patch) | |
tree | 5e7e8db4d723b7844f7c7ee4fa791465e0a4caac | |
parent | f9217c4bf11830500885c68788669caee49b6c4e (diff) | |
download | FreeBSD-src-e886c0d520510b5802f18292d53cd24fd79280a7.zip FreeBSD-src-e886c0d520510b5802f18292d53cd24fd79280a7.tar.gz |
Fix an alignment problem on alpha by doing a bytewise copy.
-rw-r--r-- | contrib/traceroute/traceroute.c | 6 | ||||
-rw-r--r-- | sbin/ping/ping.c | 9 |
2 files changed, 10 insertions, 5 deletions
diff --git a/contrib/traceroute/traceroute.c b/contrib/traceroute/traceroute.c index ba87053..cca0cdd 100644 --- a/contrib/traceroute/traceroute.c +++ b/contrib/traceroute/traceroute.c @@ -24,7 +24,7 @@ static const char copyright[] = "@(#) Copyright (c) 1988, 1989, 1991, 1994, 1995, 1996\n\ The Regents of the University of California. All rights reserved.\n"; static const char rcsid[] = - "@(#)$Header: /home/ncvs/src/contrib/traceroute/traceroute.c,v 1.4 1996/10/08 02:44:26 sef Exp $ (LBL)"; + "@(#)$Header: /home/ncvs/src/contrib/traceroute/traceroute.c,v 1.5 1996/10/08 19:16:24 sef Exp $ (LBL)"; #endif /* @@ -753,7 +753,9 @@ send_probe(register int seq, register int ttl, register struct timeval *tp) outdata->seq = seq; outdata->ttl = ttl; - outdata->tv = *tp; + + /* Avoid alignment problems by copying bytewise: */ + memcpy(&outdata->tv, tp, sizeof(outdata->tv)); i = sendto(sndsock, (char *)outip, packlen, 0, &whereto, sizeof(whereto)); diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c index 23eda9f..a7b2ed1 100644 --- a/sbin/ping/ping.c +++ b/sbin/ping/ping.c @@ -45,7 +45,7 @@ static const char copyright[] = static char sccsid[] = "@(#)ping.c 8.1 (Berkeley) 6/5/93"; */ static const char rcsid[] = - "$Id: ping.c,v 1.36 1998/05/25 06:53:17 steve Exp $"; + "$Id: ping.c,v 1.37 1998/05/25 20:16:05 fenner Exp $"; #endif /* not lint */ /* @@ -526,8 +526,11 @@ main(argc, argv) #ifdef SO_TIMESTAMP if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_TIMESTAMP && - cmsg->cmsg_len == (sizeof *cmsg + sizeof *t)) - t = (struct timeval *)CMSG_DATA(cmsg); + cmsg->cmsg_len == (sizeof *cmsg + sizeof *t)) { + /* Copy to avoid alignment problems: */ + memcpy(&now,CMSG_DATA(cmsg),sizeof(now)); + t = &now; + } #endif if (t == 0) { (void)gettimeofday(&now, NULL); |