1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00
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:
Ulrich Drepper
2000-07-16 04:35:55 +00:00
parent e993e9cc1c
commit 9ff9add9a5
4 changed files with 181 additions and 15 deletions

View File

@ -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