]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
(__getcwd): When we find a match in the scan for a name, avoid doing another readdi...
authorMiles Bader <miles@gnu.org>
Thu, 25 Apr 1996 21:37:46 +0000 (21:37 +0000)
committerMiles Bader <miles@gnu.org>
Thu, 25 Apr 1996 21:37:46 +0000 (21:37 +0000)
sysdeps/mach/hurd/getcwd.c

index abec22c12cce6894f03516a7b47641ace124a3c9..039f1341d5b53e86fba57749b3190d65b53cf50b 100644 (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)