Fix for the case where the first two entries returned by readdir() are
actually NOT '.' and '..'. Apparently this isn't the case when accessing a directory via XFS over NFS on SGI systems. Since I don't have access to an environment like that, this will sit out in -current for at least six weeks. However, the patch proposed by the submitter seems acceptable, so I've decided to commit it to the tree, in the hope that it will solve some problems without bringing up others. PR: 23300 Submitted by: Jim Pirzyk <Jim.Pirzyk@disney.com>
This commit is contained in:
parent
2b28b87554
commit
975932b1d1
@ -1055,12 +1055,6 @@ Dir_AddDir (path, name)
|
||||
p->refCount = 1;
|
||||
Hash_InitTable (&p->files, -1);
|
||||
|
||||
/*
|
||||
* Skip the first two entries -- these will *always* be . and ..
|
||||
*/
|
||||
(void)readdir(d);
|
||||
(void)readdir(d);
|
||||
|
||||
while ((dp = readdir (d)) != (struct dirent *) NULL) {
|
||||
#if defined(sun) && defined(d_ino) /* d_ino is a sunos4 #define for d_fileno */
|
||||
/*
|
||||
@ -1072,6 +1066,18 @@ Dir_AddDir (path, name)
|
||||
continue;
|
||||
}
|
||||
#endif /* sun && d_ino */
|
||||
|
||||
/* Skip the '.' and '..' entries by checking for them specifically
|
||||
* instead of assuming readdir() reuturns them in that order when
|
||||
* first going through a directory. This is needed for XFS over
|
||||
* NFS filesystems since SGI does not guarantee that these are the
|
||||
* first two entries returned from readdir().
|
||||
*/
|
||||
if (dp->d_name[0] == '.' &&
|
||||
(dp->d_name[1] == NULL ||
|
||||
(dp->d_name[1] == '.' && dp->d_name[2] == NULL)))
|
||||
continue;
|
||||
|
||||
(void)Hash_CreateEntry(&p->files, dp->d_name, (Boolean *)NULL);
|
||||
}
|
||||
(void) closedir (d);
|
||||
|
Loading…
Reference in New Issue
Block a user