mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-07 06:43:00 +03:00
Update.
2000-07-13 Andreas Jaeger <aj@suse.de> * sysdeps/unix/sysv/linux/getcwd.c (__getcwd): Correctly handle getcwd (NULL, size) with size > 0. Fixes PR libc/1788, reported by John Buddery <jvb@cyberscience.com>. 2000-07-13 Andreas Jaeger <aj@suse.de> * posix/Makefile: Remove build rules for libposix.
This commit is contained in:
11
ChangeLog
11
ChangeLog
@@ -1,3 +1,14 @@
|
|||||||
|
2000-07-13 Andreas Jaeger <aj@suse.de>
|
||||||
|
|
||||||
|
* sysdeps/unix/sysv/linux/getcwd.c (__getcwd): Correctly handle
|
||||||
|
getcwd (NULL, size) with size > 0.
|
||||||
|
Fixes PR libc/1788, reported by John Buddery
|
||||||
|
<jvb@cyberscience.com>.
|
||||||
|
|
||||||
|
2000-07-13 Andreas Jaeger <aj@suse.de>
|
||||||
|
|
||||||
|
* posix/Makefile: Remove build rules for libposix.
|
||||||
|
|
||||||
2000-07-13 Andreas Schwab <schwab@suse.de>
|
2000-07-13 Andreas Schwab <schwab@suse.de>
|
||||||
|
|
||||||
* sysdeps/generic/glob.c (glob): Fix memory leak.
|
* sysdeps/generic/glob.c (glob): Fix memory leak.
|
||||||
|
@@ -103,7 +103,7 @@ __getcwd (char *buf, size_t size)
|
|||||||
retval = INLINE_SYSCALL (getcwd, 2, CHECK_STRING (path), alloc_size);
|
retval = INLINE_SYSCALL (getcwd, 2, CHECK_STRING (path), alloc_size);
|
||||||
if (retval >= 0)
|
if (retval >= 0)
|
||||||
{
|
{
|
||||||
if (buf == NULL)
|
if (buf == NULL && size == 0)
|
||||||
{
|
{
|
||||||
buf = realloc (path, (size_t) retval);
|
buf = realloc (path, (size_t) retval);
|
||||||
if (buf == NULL)
|
if (buf == NULL)
|
||||||
@@ -115,8 +115,9 @@ __getcwd (char *buf, size_t size)
|
|||||||
|
|
||||||
# if __ASSUME_GETCWD_SYSCALL
|
# if __ASSUME_GETCWD_SYSCALL
|
||||||
/* It should never happen that the `getcwd' syscall failed because
|
/* It should never happen that the `getcwd' syscall failed because
|
||||||
the buffer is too small if we allocated the buffer outself. */
|
the buffer is too small if we allocated the buffer outselves
|
||||||
assert (errno != ERANGE || buf != NULL);
|
large enough. */
|
||||||
|
assert (errno != ERANGE || buf != NULL || size != 0);
|
||||||
|
|
||||||
if (buf == NULL)
|
if (buf == NULL)
|
||||||
free (path);
|
free (path);
|
||||||
@@ -153,8 +154,9 @@ __getcwd (char *buf, size_t size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
path[n] = '\0';
|
path[n] = '\0';
|
||||||
if (buf == NULL)
|
if (buf == NULL && size == 0)
|
||||||
{
|
{
|
||||||
|
/* Ensure that the buffer is only as large as necessary. */
|
||||||
buf = realloc (path, (size_t) n + 1);
|
buf = realloc (path, (size_t) n + 1);
|
||||||
if (buf == NULL)
|
if (buf == NULL)
|
||||||
/* `relloc' failed but we still have the original string. */
|
/* `relloc' failed but we still have the original string. */
|
||||||
|
Reference in New Issue
Block a user