From be7d999a0931203c5541714a255635459ee6dde2 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 20 Aug 1999 18:07:28 +0000 Subject: Update. * sysdeps/unix/sysv/linux/getcwd.c: Allocate buffer large enough not only if size == 0, but also for size < 0. * sysdeps/posix/getcwd.c: Likewise. [PR libc/1269] --- sysdeps/unix/sysv/linux/getcwd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sysdeps/unix/sysv/linux') diff --git a/sysdeps/unix/sysv/linux/getcwd.c b/sysdeps/unix/sysv/linux/getcwd.c index cc7b987f9b..223cd310b8 100644 --- a/sysdeps/unix/sysv/linux/getcwd.c +++ b/sysdeps/unix/sysv/linux/getcwd.c @@ -72,7 +72,7 @@ __getcwd (char *buf, size_t size) if (no_syscall_getcwd && !have_new_dcache) return generic_getcwd (buf, size); - if (size == 0) + if (size <= 0) { if (buf != NULL) { @@ -179,7 +179,7 @@ __getcwd (char *buf, size_t size) __set_errno (save_errno); /* Don't put restrictions on the length of the path unless the user does. */ - if (size == 0) + if (size <= 0) { free (path); path = NULL; @@ -187,7 +187,7 @@ __getcwd (char *buf, size_t size) result = generic_getcwd (path, size); - if (result == NULL && buf == NULL && size != 0) + if (result == NULL && buf == NULL && size > 0) free (path); return result; -- cgit v1.2.3