Wed May 1 09:10:04 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>

* sysdeps/mach/hurd/getcwd.c: Jump out of both loops when we find a
	name, instead of checking for reaching end of buffer, which happens
	when the match is the last entry in the buffer.
This commit is contained in:
Roland McGrath 1996-05-02 00:26:56 +00:00
parent 75cd5204dd
commit f5936b69da

View File

@ -185,14 +185,9 @@ __getcwd (char *buf, size_t size)
if (err) if (err)
goto errlose; goto errlose;
if (st.st_dev == thisdev && st.st_ino == thisino) if (st.st_dev == thisdev && st.st_ino == thisino)
break; goto found;
} }
} }
if (offset < dirdatasize)
/* We got a match; avoid doing another dir_readdir, which will
hose NENTRIES. */
break;
} }
if (err) if (err)
@ -206,6 +201,7 @@ __getcwd (char *buf, size_t size)
goto errlose; goto errlose;
} }
else else
found:
{ {
/* Prepend the directory name just discovered. */ /* Prepend the directory name just discovered. */