diff options
| author | nakayama <nakayama@NetBSD.org> | 2007-03-02 13:18:55 +0000 |
|---|---|---|
| committer | nakayama <nakayama@NetBSD.org> | 2007-03-02 13:18:55 +0000 |
| commit | b0cfe41e9b15098d63f1fcccbc105f8ed2ce8f8a (patch) | |
| tree | a60946865ca01ec959a25f6627e211c0d13476fe /lib/libc | |
| parent | cdbe0f0296b9be609a9bb60994314d45bd42ffd3 (diff) | |
PR lib/34210: Avoid bus error (unaligned 64-bit access) on sparc64.
Diffstat (limited to 'lib/libc')
| -rw-r--r-- | lib/libc/compat/sys/compat_getdents.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/libc/compat/sys/compat_getdents.c b/lib/libc/compat/sys/compat_getdents.c index b57d72052e7..bf77aae7a52 100644 --- a/lib/libc/compat/sys/compat_getdents.c +++ b/lib/libc/compat/sys/compat_getdents.c @@ -1,4 +1,4 @@ -/* $NetBSD: compat_getdents.c,v 1.1 2005/09/13 01:44:09 christos Exp $ */ +/* $NetBSD: compat_getdents.c,v 1.2 2007/03/02 13:18:55 nakayama Exp $ */ /*- * Copyright (c) 2005 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ #include <sys/cdefs.h> #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: compat_getdents.c,v 1.1 2005/09/13 01:44:09 christos Exp $"); +__RCSID("$NetBSD: compat_getdents.c,v 1.2 2007/03/02 13:18:55 nakayama Exp $"); #endif /* LIBC_SCCS and not lint */ #define __LIBC12_SOURCE__ @@ -73,7 +73,8 @@ getdents(int fd, char *buf, size_t nbytes) */ for (; ndp < endp; ndp = nndp) { nndp = _DIRENT_NEXT(ndp); - odp->d_ino = (u_int32_t)ndp->d_ino; + /* XXX: avoid unaligned 64-bit access on sparc64 */ + odp->d_ino = ((u_int32_t *)(void *)&ndp->d_ino)[_QUAD_LOWWORD]; if (ndp->d_namlen >= sizeof(odp->d_name)) odp->d_namlen = sizeof(odp->d_name) - 1; else |
