diff options
author | Christopher Faylor <me@cgf.cx> | 2000-05-04 19:46:32 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2000-05-04 19:46:32 +0000 |
commit | 8e9b0aee252c4b8c055c2bfa290ab80d11a57562 (patch) | |
tree | 9355416ac95e34d55c68a1d2db8861de6c5d0787 /winsup | |
parent | cf3eb87bef10617d2437230718a6a037b943b8ed (diff) | |
download | cygnal-8e9b0aee252c4b8c055c2bfa290ab80d11a57562.tar.gz cygnal-8e9b0aee252c4b8c055c2bfa290ab80d11a57562.tar.bz2 cygnal-8e9b0aee252c4b8c055c2bfa290ab80d11a57562.zip |
* configure.in: Use -gstabs+ as compile debug option. This seems to promote
better handling of symbols.
* configure: Regenerate.
* delqueue.cc (delqueue_list::process_queue): Allow ERROR_ACCESS_DENIED to
indicate that a file is being shared under Windows 95.
* syscalls.cc (_unlink): Use full path name. Take special action for Windows
95. Assume that an ERROR_ACCESS_DENIED indicates a sharing violation unless
it's on a remote drive. Punt if there is an ERROR_ACCESS_DENIED on a remote
drive.
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/cygwin/ChangeLog | 12 | ||||
-rw-r--r-- | winsup/cygwin/delqueue.cc | 3 | ||||
-rw-r--r-- | winsup/cygwin/path.cc | 6 | ||||
-rw-r--r-- | winsup/cygwin/syscalls.cc | 46 |
4 files changed, 42 insertions, 25 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index d75ee33b7..a0392cd6a 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,15 @@ +Wed May 3 21:54:11 2000 Christopher Faylor <cgf@cygnus.com> + + * configure.in: Use -gstabs+ as compile debug option. This seems to + promote better handling of symbols. + * configure: Regenerate. + * delqueue.cc (delqueue_list::process_queue): Allow ERROR_ACCESS_DENIED + to indicate that a file is being shared under Windows 95. + * syscalls.cc (_unlink): Use full path name. Take special action for + Windows 95. Assume that an ERROR_ACCESS_DENIED indicates a sharing + violation unless it's on a remote drive. Punt if there is an + ERROR_ACCESS_DENIED on a remote drive. + Wed May 3 18:07:00 2000 Corinna Vinschen <corinna@vinschen.de> * errno.cc (errmap): Map ERROR_BAD_NETPATH to new errno ENOSHARE. diff --git a/winsup/cygwin/delqueue.cc b/winsup/cygwin/delqueue.cc index 17feb6991..08a17fd75 100644 --- a/winsup/cygwin/delqueue.cc +++ b/winsup/cygwin/delqueue.cc @@ -85,7 +85,8 @@ delqueue_list::process_queue () { int res = GetLastError (); empty = 0; - if (res == ERROR_SHARING_VIOLATION) + if (res == ERROR_SHARING_VIOLATION || + (os_being_run != winNT && res == ERROR_ACCESS_DENIED)) { /* File still inuse, that's ok */ syscall_printf ("Still using %s", name[i]); diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index 15194e937..205aae406 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -45,12 +45,6 @@ details. */ paths. Win32 paths in mount table entries may be UNC paths or standard Win32 paths starting with <drive-letter>: - In converting from a Win32 to a POSIX pathname, if there is no - mount point that will allow the conversion to take place, a user - mount point will be automatically created under - cygdrive/<drive> and the translation will be redone, this - time successfully. - Text vs Binary issues are not considered here in path style decisions. diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 529c7f627..51b37b457 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -47,7 +47,7 @@ _unlink (const char *ourname) { int res = -1; - path_conv win32_name (ourname, SYMLINK_NOFOLLOW); + path_conv win32_name (ourname, SYMLINK_NOFOLLOW, 1); if (win32_name.error) { @@ -82,6 +82,9 @@ _unlink (const char *ourname) break; } + DWORD lasterr; + lasterr = GetLastError (); + /* FIXME: There's a race here. */ HANDLE h = CreateFile (win32_name, GENERIC_READ, FILE_SHARE_READ, @@ -91,7 +94,7 @@ _unlink (const char *ourname) { CloseHandle (h); syscall_printf ("CreateFile/CloseHandle succeeded"); - if (i > 0 || GetFileAttributes (win32_name) == (DWORD) -1) + if (os_being_run == winNT || GetFileAttributes (win32_name) == (DWORD) -1) { res = 0; break; @@ -99,33 +102,40 @@ _unlink (const char *ourname) } if (i > 0) - goto err; - - res = GetLastError (); - syscall_printf ("couldn't delete file, %E"); - - /* if access denied, chmod to be writable in case it is not - and try again */ - /* FIXME!!! Should check whether ourname is directory or file - and only try again if permissions are not sufficient */ - if (res == ERROR_ACCESS_DENIED) { - /* chmod file to be writable here */ - if (chmod (win32_name, 0777) == 0) - continue; - else + DWORD dtype; + if (os_being_run == winNT || lasterr != ERROR_ACCESS_DENIED) goto err; + + char root[MAX_PATH]; + strcpy (root, win32_name); + dtype = GetDriveType (rootdir (root)); + if (dtype & DRIVE_REMOTE) + { + syscall_printf ("access denied on remote drive"); + goto err; /* Can't detect this, unfortunately */ + } + lasterr = ERROR_SHARING_VIOLATION; } + syscall_printf ("i %d, couldn't delete file, %E", i); + /* If we get ERROR_SHARING_VIOLATION, the file may still be open - Windows NT doesn't support deleting a file while it's open. */ - if (res == ERROR_SHARING_VIOLATION) + if (lasterr == ERROR_SHARING_VIOLATION) { cygwin_shared->delqueue.queue_file (win32_name); res = 0; break; } + /* if access denied, chmod to be writable in case it is not + and try again */ + /* FIXME: Should check whether ourname is directory or file + and only try again if permissions are not sufficient */ + if (lasterr == ERROR_ACCESS_DENIED && chmod (win32_name, 0777) == 0) + continue; + err: __seterrno (); res = -1; @@ -965,7 +975,7 @@ stat_dev (DWORD devn, int unit, unsigned long ino, struct stat *buf) return 0; } -suffix_info stat_suffixes[] = +suffix_info stat_suffixes[] = { suffix_info ("", 1), suffix_info (".exe", 1), |