* 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]
1999-08-20 Ulrich Drepper <drepper@cygnus.com>
- * sysdeps/posix/getcwd.c: Allocate buffer large enough not only if
- size == 0, but also for size < 0 [PR libc/1269].
+ * 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]
* posix/execvp.c (execvp): Allocate array name of correct size.
Optimize inner loop. Use execve directly, not execv.
int prev_errno = errno;
size_t allocated = size;
- if (size == 0)
+ if (size <= 0)
{
if (buf != NULL)
{
if ((size_t) (pathp - path) <= namlen)
{
- if (size != 0)
+ if (size > 0)
{
(void) __closedir (dirstream);
__set_errno (ERANGE);
if (no_syscall_getcwd && !have_new_dcache)
return generic_getcwd (buf, size);
- if (size == 0)
+ if (size <= 0)
{
if (buf != NULL)
{
__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;
result = generic_getcwd (path, size);
- if (result == NULL && buf == NULL && size != 0)
+ if (result == NULL && buf == NULL && size > 0)
free (path);
return result;