Formerly unix/readdir.c.~3~
authorroland <roland>
Sat, 22 May 1993 22:58:53 +0000 (22:58 +0000)
committerroland <roland>
Sat, 22 May 1993 22:58:53 +0000 (22:58 +0000)
sysdeps/unix/readdir.c

index 645f36a..9b5795b 100644 (file)
@@ -66,6 +66,9 @@ DEFUN(readdir, (dirp), DIR *dirp)
          register struct dirent *d = &dirp->__entry;
          d->d_fileno = (ino_t) dp->d_ino;
          d->d_namlen = (size_t) D_NAMLEN (dp);
+         /* On some systems the name length does not actually mean much.  */
+         while (dp->d_name[d->d_namlen - 1] == '\0')
+           --d->d_namlen;
          (void) strncpy (d->d_name, dp->d_name, d->d_namlen + 1);
          return d;
        }