mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-29 11:41:21 +03:00
Update.
2000-07-15 Ulrich Drepper <drepper@redhat.com> * sysdeps/unix/sysv/linux/getcwd.c: Correct last patch. Patch by Greg McGary <greg@mcgary.org>. * io/Makefile (tests): Add tst-getcwd. * io/tst-getcwd.c: New file.
This commit is contained in:
@ -104,13 +104,14 @@ __getcwd (char *buf, size_t size)
|
||||
if (retval >= 0)
|
||||
{
|
||||
if (buf == NULL && size == 0)
|
||||
{
|
||||
/* Ensure that the buffer is only as large as necessary. */
|
||||
buf = realloc (path, (size_t) retval);
|
||||
if (buf == NULL)
|
||||
/* `realloc' failed but we still have the original string. */
|
||||
buf = path;
|
||||
}
|
||||
/* Ensure that the buffer is only as large as necessary. */
|
||||
buf = realloc (path, (size_t) retval);
|
||||
|
||||
if (buf == NULL)
|
||||
/* Either buf was NULL all along, or `realloc' failed but
|
||||
we still have the original string. */
|
||||
buf = path;
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
@ -156,13 +157,13 @@ __getcwd (char *buf, size_t size)
|
||||
|
||||
path[n] = '\0';
|
||||
if (buf == NULL && size == 0)
|
||||
{
|
||||
/* Ensure that the buffer is only as large as necessary. */
|
||||
buf = realloc (path, (size_t) n + 1);
|
||||
if (buf == NULL)
|
||||
/* `relloc' failed but we still have the original string. */
|
||||
buf = path;
|
||||
}
|
||||
/* Ensure that the buffer is only as large as necessary. */
|
||||
buf = realloc (path, (size_t) n + 1);
|
||||
if (buf == NULL)
|
||||
/* Either buf was NULL all along, or `realloc' failed but
|
||||
we still have the original string. */
|
||||
buf = path;
|
||||
|
||||
return buf;
|
||||
}
|
||||
#ifndef have_new_dcache
|
||||
|
Reference in New Issue
Block a user