Readd fix for FreeBSD PR/30631.
authorJoerg Sonnenberger <joerg@dragonflybsd.org>
Tue, 2 Aug 2005 16:26:30 +0000 (16:26 +0000)
committerJoerg Sonnenberger <joerg@dragonflybsd.org>
Tue, 2 Aug 2005 16:26:30 +0000 (16:26 +0000)
No-cookie-for: David Rhodus

lib/libc/gen/readdir.c

index da3f01c..f693e35 100644 (file)
@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/lib/libc/gen/readdir.c,v 1.5.2.4 2002/02/26 22:53:57 alfred Exp $
- * $DragonFly: src/lib/libc/gen/readdir.c,v 1.4 2005/02/08 04:07:57 drhodus Exp $
+ * $DragonFly: src/lib/libc/gen/readdir.c,v 1.5 2005/08/02 16:26:30 joerg Exp $
  *
  * @(#)readdir.c       8.3 (Berkeley) 9/29/94
  */
@@ -112,11 +112,11 @@ readdir_r(dirp, entry, result)
        if (__isthreaded) {
                _pthread_mutex_lock((pthread_mutex_t *)&dirp->dd_lock);
                if ((dp = _readdir_unlocked(dirp)) != NULL)
-                       memcpy(entry, dp, sizeof *entry);
+                       memcpy(entry, dp, _GENERIC_DIRSIZ(dp));
                _pthread_mutex_unlock((pthread_mutex_t *)&dirp->dd_lock);
        }
        else if ((dp = _readdir_unlocked(dirp)) != NULL)
-               memcpy(entry, dp, sizeof *entry);
+               memcpy(entry, dp, _GENERIC_DIRSIZ(dp));
 
        if (errno != 0) {
                if (dp == NULL) {