* path.cc (getcwd): Allow len == 0 when buf == NULL.

This commit is contained in:
Corinna Vinschen 2001-10-19 19:17:04 +00:00
parent da8f3291d1
commit 5318c49833
2 changed files with 5 additions and 1 deletions

View File

@ -1,3 +1,7 @@
2001-10-19 Corinna Vinschen <corinna@vinschen.de>
* path.cc (getcwd): Allow len == 0 when buf == NULL.
2001-10-18 Christopher Faylor <cgf@redhat.com> 2001-10-18 Christopher Faylor <cgf@redhat.com>
* syscalls.cc (_read): Validate input pointer. * syscalls.cc (_read): Validate input pointer.

View File

@ -3120,7 +3120,7 @@ char *
getcwd (char *buf, size_t ulen) getcwd (char *buf, size_t ulen)
{ {
char* res = NULL; char* res = NULL;
if (ulen == 0) if (ulen == 0 && buf)
set_errno (EINVAL); set_errno (EINVAL);
else if (buf == NULL || !__check_null_invalid_struct_errno (buf, ulen)) else if (buf == NULL || !__check_null_invalid_struct_errno (buf, ulen))
res = cygheap->cwd.get (buf, 1, 1, ulen); res = cygheap->cwd.get (buf, 1, 1, ulen);