Fix an alignment problem on alpha by doing a bytewise copy.

This commit is contained in:
John Birrell 1998-06-06 23:33:28 +00:00
parent 1c16aba2c7
commit fa05a94c42
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=36713
2 changed files with 10 additions and 5 deletions

View File

@ -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));

View File

@ -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);