From 0f0f563b6e75a78c4b27456dd7d07bf4e7951c75 Mon Sep 17 00:00:00 2001 From: naddy Date: Mon, 24 Jun 2002 12:40:11 +0000 Subject: Fix unaligned access error. Reviewed by: ticso --- usr.bin/locate/locate/util.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'usr.bin') diff --git a/usr.bin/locate/locate/util.c b/usr.bin/locate/locate/util.c index ab77699..944ca88 100644 --- a/usr.bin/locate/locate/util.c +++ b/usr.bin/locate/locate/util.c @@ -231,13 +231,16 @@ int getwm(p) caddr_t p; { - static char buf[INTSIZE]; + union { + char buf[INTSIZE]; + int i; + } u; register int i; for (i = 0; i < INTSIZE; i++) - buf[i] = *p++; + u.buf[i] = *p++; - i = *(int *)buf; + i = u.i; if (i > MAXPATHLEN || i < -(MAXPATHLEN)) { i = ntohl(i); -- cgit v1.1