summaryrefslogtreecommitdiffstats
path: root/usr.bin/make
diff options
context:
space:
mode:
authorwill <will@FreeBSD.org>2000-12-26 07:36:07 +0000
committerwill <will@FreeBSD.org>2000-12-26 07:36:07 +0000
commit975932b1d1023ba4396b985a8986038896b7037b (patch)
tree542f660b6bd93e1a098257ed1e50c6b247c40772 /usr.bin/make
parent2b28b875546c2eafa60d788426f757140f4aff77 (diff)
downloadFreeBSD-src-975932b1d1023ba4396b985a8986038896b7037b.zip
FreeBSD-src-975932b1d1023ba4396b985a8986038896b7037b.tar.gz
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>
Diffstat (limited to 'usr.bin/make')
-rw-r--r--usr.bin/make/dir.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/usr.bin/make/dir.c b/usr.bin/make/dir.c
index 0c4bac7..f920731 100644
--- a/usr.bin/make/dir.c
+++ b/usr.bin/make/dir.c
@@ -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);
OpenPOWER on IntegriCloud