mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-29 18:40:25 +08:00
* path.cc (cwdstuff::get): Set EINVAL when length is zero.
This commit is contained in:
parent
a8018ef336
commit
e62ae31192
@ -1,3 +1,7 @@
|
||||
Tue Oct 10 15:21:10 2000 Christopher Faylor <cgf@cygnus.com>
|
||||
|
||||
* path.cc (cwdstuff::get): Set EINVAL when length is zero.
|
||||
|
||||
Mon Oct 9 14:07:04 2000 Christopher Faylor <cgf@cygnus.com>
|
||||
|
||||
* path.cc (mount_info::cygdrive_posix_path): Handle e:foo construction
|
||||
|
@ -2937,6 +2937,13 @@ char *
|
||||
cwdstuff::get (char *buf, int need_posix, int with_chroot, unsigned ulen)
|
||||
{
|
||||
MALLOC_CHECK;
|
||||
|
||||
if (ulen == 0)
|
||||
{
|
||||
set_errno (EINVAL);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!get_initial ()) /* Get initial cwd and set cwd lock */
|
||||
return NULL;
|
||||
|
||||
@ -2955,7 +2962,7 @@ cwdstuff::get (char *buf, int need_posix, int with_chroot, unsigned ulen)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (need_posix && !buf)
|
||||
if (!buf)
|
||||
buf = (char *) malloc (strlen (tocopy) + 1);
|
||||
strcpy (buf, tocopy);
|
||||
if (!buf[0]) /* Should only happen when chroot */
|
||||
@ -2963,8 +2970,10 @@ cwdstuff::get (char *buf, int need_posix, int with_chroot, unsigned ulen)
|
||||
}
|
||||
|
||||
lock->release ();
|
||||
syscall_printf ("(%s) = cwdstuff::get (%p, %d, %d, %d)",
|
||||
buf, buf, ulen, need_posix, with_chroot);
|
||||
|
||||
out:
|
||||
syscall_printf ("(%s) = cwdstuff::get (%p, %d, %d, %d), errno %d",
|
||||
buf, buf, ulen, need_posix, with_chroot, errno);
|
||||
MALLOC_CHECK;
|
||||
return buf;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user