OSDN Git Service

* syscalls.cc (stat_worker): Don't call build_fh_pc with invalid pc.
authorcorinna <corinna>
Mon, 30 Jul 2007 10:05:26 +0000 (10:05 +0000)
committercorinna <corinna>
Mon, 30 Jul 2007 10:05:26 +0000 (10:05 +0000)
winsup/cygwin/ChangeLog
winsup/cygwin/syscalls.cc

index 26d4c52..85f3303 100644 (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
index 83b7bbb..290253c 100644 (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;
 }