(__getcwd): When we find a match in the scan for a name, avoid doing another readdir (which overwrites NENTRIES, and was resulting in a bogus ENOENT).

This commit is contained in:
Miles Bader 1996-04-25 21:37:46 +00:00
parent 8ec2f30995
commit 072d114510
1 changed files with 6 additions and 0 deletions

View File

@ -119,6 +119,7 @@ __getcwd (char *buf, size_t size)
unsigned int dirdatasize;
int direntry, nentries;
/* Look at the parent directory. */
newp = __file_name_lookup_under (parent, "..", O_READ, 0);
if (newp == MACH_PORT_NULL)
@ -187,6 +188,11 @@ __getcwd (char *buf, size_t size)
break;
}
}
if (offset < dirdatasize)
/* We got a match; avoid doing another dir_readdir, which will
hose NENTRIES. */
break;
}
if (err)