OSDN Git Service

* path.cc (symlink_info::check): Handle (and explain) a special case
authorcorinna <corinna>
Thu, 31 Jul 2008 14:48:27 +0000 (14:48 +0000)
committercorinna <corinna>
Thu, 31 Jul 2008 14:48:27 +0000 (14:48 +0000)
when accessing files matching DOS device names on SMB shares.

winsup/cygwin/ChangeLog
winsup/cygwin/path.cc

index d6b1743..d1c1ae7 100644 (file)
@@ -1,5 +1,10 @@
 2008-07-31  Corinna Vinschen  <corinna@vinschen.de>
 
+       * path.cc (symlink_info::check): Handle (and explain) a special case
+       when accessing files matching DOS device names on SMB shares.
+
+2008-07-31  Corinna Vinschen  <corinna@vinschen.de>
+
        * spawn.cc (spawn_guts): Check constructed short pathname for being
        a DOS device name and fall back to long path name, if so.
 
index 66e1747..64d8759 100644 (file)
@@ -2440,6 +2440,18 @@ symlink_info::check (char *path, const suffix_info *suffixes, unsigned opt,
                    {
                      debug_printf ("%p = NtQueryDirectoryFile(%S)",
                                    status, &dirname);
+                     if (status == STATUS_NO_SUCH_FILE)
+                       {
+                         /* This can happen when trying to access files
+                            which match DOS device names on SMB shares.
+                            NtOpenFile failed with STATUS_ACCESS_DENIED,
+                            but the NtQueryDirectoryFile tells us the
+                            file doesn't exist.  We're suspicious in this
+                            case and retry with the next suffix instead of
+                            just giving up. */
+                         set_error (ENOENT);
+                         continue;
+                       }
                      fileattr = 0;
                    }
                  else