diff options
author | Miles Bader <miles@gnu.org> | 1996-04-25 21:37:46 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 1996-04-25 21:37:46 +0000 |
commit | 072d114510658495a9f241864e0194d542b47a08 (patch) | |
tree | 43608b4ad39c55f6a8f710ad670e90d4aebc4451 | |
parent | (__fcntl): Add missing break after F_SETFL. (diff) | |
download | glibc-072d114510658495a9f241864e0194d542b47a08.tar.gz glibc-072d114510658495a9f241864e0194d542b47a08.tar.bz2 glibc-072d114510658495a9f241864e0194d542b47a08.zip |
(__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).
-rw-r--r-- | sysdeps/mach/hurd/getcwd.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sysdeps/mach/hurd/getcwd.c b/sysdeps/mach/hurd/getcwd.c index abec22c12c..039f1341d5 100644 --- a/sysdeps/mach/hurd/getcwd.c +++ b/sysdeps/mach/hurd/getcwd.c @@ -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) |