diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 8c99c3c42..c85667987 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,13 @@ +2007-02-22 Corinna Vinschen + + Throughout remove all usage of wincap.access_denied_on_delete. + * dir.cc (rmdir): Add existance check to be errno-compatible with Linux. + * fhandler_disk_file.cc (fhandler_disk_file::rmdir): Drop test for + non-existent dir on 9x share. + * syscalls.cc (unlink): Add comment. + * wincap.cc: Remove access_denied_on_delete flag throughout. + * wincap.h: Ditto. + 2007-02-22 Corinna Vinschen * fhandler_disk_file.cc (fhandler_disk_file::closedir): Fix bug diff --git a/winsup/cygwin/delqueue.cc b/winsup/cygwin/delqueue.cc index 76f2d6d19..2cc14d546 100644 --- a/winsup/cygwin/delqueue.cc +++ b/winsup/cygwin/delqueue.cc @@ -1,6 +1,6 @@ /* delqueue.cc - Copyright 1996, 1998, 1999, 2000, 2001 Red Hat, Inc. + Copyright 1996, 1998, 1999, 2000, 2001, 2007 Red Hat, Inc. This file is part of Cygwin. @@ -86,9 +86,7 @@ delqueue_list::process_queue () { int res = GetLastError (); empty = 0; - if (res == ERROR_SHARING_VIOLATION || - (wincap.access_denied_on_delete () - && res == ERROR_ACCESS_DENIED)) + if (res == ERROR_SHARING_VIOLATION) { /* File still inuse, that's ok */ syscall_printf ("Still using %s", name[i]); diff --git a/winsup/cygwin/dir.cc b/winsup/cygwin/dir.cc index 1b4e93a45..63467b7fb 100644 --- a/winsup/cygwin/dir.cc +++ b/winsup/cygwin/dir.cc @@ -309,6 +309,8 @@ rmdir (const char *dir) } else if (has_dot_last_component (dir, false)) set_errno (fh->exists () ? EINVAL : ENOENT); + else if (!fh->exists ()) + set_errno (ENOENT); else if (!fh->rmdir ()) res = 0; diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index 9bc7b834a..a7136550c 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -1404,16 +1404,6 @@ fhandler_disk_file::rmdir () } else err = GetLastError (); - /* On 9X ERROR_ACCESS_DENIED is returned if you try to remove a - non-empty directory. */ - if (err == ERROR_ACCESS_DENIED - && wincap.access_denied_on_delete ()) - err = ERROR_DIR_NOT_EMPTY; - /* ...and, that's *not* funny, when trying to remove a non-existing - directory on a share, which is hosted by a 9x machine, the error - code ERROR_INVALID_FUNCTION is returned. */ - else if (err == ERROR_INVALID_FUNCTION) - err = ERROR_FILE_NOT_FOUND; __seterrno_from_win_error (err); diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 5e2bb5b66..ed11037d9 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -392,11 +392,8 @@ unlink (const char *ourname) { SetFileAttributes (win32_name, (DWORD) win32_name); - /* Windows 9x seems to report ERROR_ACCESS_DENIED rather than sharing - violation. */ - if ((wincap.access_denied_on_delete () && lasterr == ERROR_ACCESS_DENIED - && !win32_name.isremote ()) - || lasterr == ERROR_SHARING_VIOLATION) + /* FIXME: Can we get rid of the delqueue now? */ + if (lasterr == ERROR_SHARING_VIOLATION) { /* Add file to the "to be deleted" queue. */ syscall_printf ("Sharing violation, couldn't delete file"); @@ -1443,14 +1440,7 @@ rename (const char *oldpath, const char *newpath) /* Since neither MoveFileEx(MOVEFILE_REPLACE_EXISTING) nor DeleteFile allow to remove directories, this case is handled separately. */ if (!RemoveDirectoryA (real_new)) - { - syscall_printf ("Can't remove target directory"); - /* On 9X ERROR_ACCESS_DENIED is returned if you try to remove - a non-empty directory. */ - if (GetLastError () == ERROR_ACCESS_DENIED - && wincap.access_denied_on_delete ()) - SetLastError (ERROR_DIR_NOT_EMPTY); - } + syscall_printf ("Can't remove target directory"); else if (MoveFile (real_old, real_new)) res = 0; } diff --git a/winsup/cygwin/wincap.cc b/winsup/cygwin/wincap.cc index baa708c7a..0be5446e8 100644 --- a/winsup/cygwin/wincap.cc +++ b/winsup/cygwin/wincap.cc @@ -17,7 +17,6 @@ static NO_COPY wincaps wincap_unknown = { chunksize:0, heapslop:0x0, is_server:false, - access_denied_on_delete:false, has_delete_on_close:true, has_page_guard:true, has_security:true, @@ -81,7 +80,6 @@ static NO_COPY wincaps wincap_nt4 = { chunksize:0, heapslop:0x0, is_server:false, - access_denied_on_delete:false, has_delete_on_close:true, has_page_guard:true, has_security:true, @@ -145,7 +143,6 @@ static NO_COPY wincaps wincap_nt4sp4 = { chunksize:0, heapslop:0x0, is_server:false, - access_denied_on_delete:false, has_delete_on_close:true, has_page_guard:true, has_security:true, @@ -209,7 +206,6 @@ static NO_COPY wincaps wincap_2000 = { chunksize:0, heapslop:0x0, is_server:false, - access_denied_on_delete:false, has_delete_on_close:true, has_page_guard:true, has_security:true, @@ -273,7 +269,6 @@ static NO_COPY wincaps wincap_xp = { chunksize:0, heapslop:0x0, is_server:false, - access_denied_on_delete:false, has_delete_on_close:true, has_page_guard:true, has_security:true, @@ -337,7 +332,6 @@ static NO_COPY wincaps wincap_2003 = { chunksize:0, heapslop:0x4, is_server:true, - access_denied_on_delete:false, has_delete_on_close:true, has_page_guard:true, has_security:true, @@ -401,7 +395,6 @@ static NO_COPY wincaps wincap_vista = { chunksize:0, heapslop:0x4, is_server:false, - access_denied_on_delete:false, has_delete_on_close:true, has_page_guard:true, has_security:true, diff --git a/winsup/cygwin/wincap.h b/winsup/cygwin/wincap.h index da046a1e8..645ded1ff 100644 --- a/winsup/cygwin/wincap.h +++ b/winsup/cygwin/wincap.h @@ -17,7 +17,6 @@ struct wincaps DWORD chunksize; DWORD heapslop; unsigned is_server : 1; - unsigned access_denied_on_delete : 1; unsigned has_delete_on_close : 1; unsigned has_page_guard : 1; unsigned has_security : 1; @@ -97,7 +96,6 @@ public: DWORD IMPLEMENT (chunksize) DWORD IMPLEMENT (heapslop) bool IMPLEMENT (is_server) - bool IMPLEMENT (access_denied_on_delete) bool IMPLEMENT (has_delete_on_close) bool IMPLEMENT (has_page_guard) bool IMPLEMENT (has_security)