From 3462d736b64e2601971fb185cbf83cb8828208c3 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Thu, 31 Jul 2008 14:48:28 +0000 Subject: [PATCH] * path.cc (symlink_info::check): Handle (and explain) a special case when accessing files matching DOS device names on SMB shares. --- winsup/cygwin/ChangeLog | 5 +++++ winsup/cygwin/path.cc | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index d6b17439d..d1c1ae7c3 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2008-07-31 Corinna Vinschen + + * 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 * spawn.cc (spawn_guts): Check constructed short pathname for being diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index 66e174771..64d8759b6 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -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