about summary refs log tree commit diff
path: root/dirent/scandir.c
diff options
context:
space:
mode:
Diffstat (limited to 'dirent/scandir.c')
-rw-r--r--dirent/scandir.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/dirent/scandir.c b/dirent/scandir.c
index e2ef63a9ce..6907f0873f 100644
--- a/dirent/scandir.c
+++ b/dirent/scandir.c
@@ -64,7 +64,7 @@ DEFUN(scandir, (dir, namelist, select, cmp),
 	    v = new;
 	  }
 
-	dsize = &d->d_name[d->d_namlen + 1] - (char *) d;
+	dsize = &d->d_name[_D_ALLOC_NAMLEN (d)] - (char *) d;
 	v[i] = (struct dirent *) malloc (dsize);
 	if (v[i] == NULL)
 	  goto lose;