* syscalls.cc (stat_worker): Don't call build_fh_pc with invalid pc.

This commit is contained in:
Corinna Vinschen 2007-07-30 10:05:27 +00:00
parent bcf7308f02
commit 73151c54d5
2 changed files with 15 additions and 10 deletions

View File

@ -1,3 +1,7 @@
2007-07-30 Corinna Vinschen <corinna@vinschen.de>
* syscalls.cc (stat_worker): Don't call build_fh_pc with invalid pc.
2007-07-29 Christopher Faylor <me+cygwin@cgf.cx>
* fhandler.cc (fhandler_base::wait_overlapped): Handle read EOF better

View File

@ -1202,22 +1202,23 @@ int __stdcall
stat_worker (path_conv &pc, struct __stat64 *buf)
{
int res = -1;
fhandler_base *fh = NULL;
myfault efault;
if (efault.faulted (EFAULT))
goto error;
if (!(fh = build_fh_pc (pc)))
goto error;
if (fh->error ())
if (pc.error)
{
debug_printf ("got %d error from build_fh_name", fh->error ());
set_errno (fh->error ());
debug_printf ("got %d error from build_fh_name", pc.error);
set_errno (pc.error);
}
else if (fh->exists ())
else if (pc.exists ())
{
fhandler_base *fh;
if (!(fh = build_fh_pc (pc)))
goto error;
debug_printf ("(%s, %p, %p), file_attributes %d",
pc.normalized_path, buf, fh, (DWORD) *fh);
memset (buf, 0, sizeof (*buf));
@ -1231,14 +1232,14 @@ stat_worker (path_conv &pc, struct __stat64 *buf)
if (!buf->st_rdev)
buf->st_rdev = buf->st_dev;
}
delete fh;
}
else
set_errno (ENOENT);
delete fh;
error:
MALLOC_CHECK;
syscall_printf ("%d = (%s, %p)", res, pc.normalized_path, buf);
syscall_printf ("%d = (%s, %p)", res, pc.normalized_path ?: "", buf);
return res;
}