diff options
Diffstat (limited to 'winsup/cygwin/path.cc')
-rw-r--r-- | winsup/cygwin/path.cc | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index 2f9c450cb..7ba5b51e7 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -3159,15 +3159,24 @@ symlink_info::check (char *path, const suffix_info *suffixes, unsigned opt) /* The above comment is not *quite* right. When calling GetFileAttributes for a non-existant file an a Win9x share, - GetLastError returns ERROR_INVALID_FUNCTION. Go figure! */ + GetLastError returns ERROR_INVALID_FUNCTION. Go figure! + Also, GetFileAttributes fails with ERROR_SHARING_VIOLATION + if the file is locked exclusively by another process. + If we don't special handle this here, the file is accidentally + treated as non-existant. */ DWORD win_error = GetLastError (); if (win_error == ERROR_INVALID_FUNCTION) win_error = ERROR_FILE_NOT_FOUND; + else if (win_error == ERROR_SHARING_VIOLATION) + { + ext_tacked_on = !!*ext_here; + fileattr = 0; + goto file_not_symlink; + } set_error (geterrno_from_win_error (win_error, EACCES)); continue; } - ext_tacked_on = !!*ext_here; if (pcheck_case != PCHECK_RELAXED && !case_check (path) |