* path.cc (symlink_info::check): If GetFileAttributes returns

with ERROR_SHARING_VIOLATION, the file exists.
This commit is contained in:
Corinna Vinschen 2005-06-06 16:58:39 +00:00
parent 34667bbd39
commit 7a70dda0b8
2 changed files with 16 additions and 2 deletions

View File

@ -1,3 +1,8 @@
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.

View File

@ -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)