diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2005-06-06 20:58:39 +0400 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2005-06-06 20:58:39 +0400 |
commit | 7a70dda0b8817e5eb2d6bc1ccead458fa74ae2c7 (patch) | |
tree | 21a9b8ff854dcb14ada266cfba5efa620708dcd7 /winsup | |
parent | 34667bbd39352993360f87f8fd8983c8908a63d6 (diff) |
* path.cc (symlink_info::check): If GetFileAttributes returns
with ERROR_SHARING_VIOLATION, the file exists.
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/cygwin/ChangeLog | 5 | ||||
-rw-r--r-- | winsup/cygwin/path.cc | 13 |
2 files changed, 16 insertions, 2 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index d46ea5149..fba4cc2e1 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,5 +1,10 @@ 2005-06-06 Corinna Vinschen <corinna@vinschen.de> + * path.cc (symlink_info::check): If GetFileAttributes returns + with ERROR_SHARING_VIOLATION, the file exists. + +2005-06-06 Corinna Vinschen <corinna@vinschen.de> + * uname.cc (uname): Change "amd64" to "x86_64" as on Linux. 2005-06-06 Corinna Vinschen <corinna@vinschen.de> 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) |