diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 18b92a794..848b71f76 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2010-09-11 Corinna Vinschen + + * fhandler_disk_file.cc (fhandler_disk_file::rmdir): More thoroughly + check the existence condition on remote drives. Enhance comment. + 2010-09-11 Dave Korn * Makefile.in (DLL_OFILES): Add new fenv.o module. diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index 1d7675c34..c7ecf48e8 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -1609,18 +1609,20 @@ fhandler_disk_file::rmdir () /* Check for existence of remote dirs after trying to delete them. Two reasons: - Sometimes SMB indicates failure when it really succeeds. - - Removeing a directory on a samba drive doesn't return an error if the - directory can't be removed because it's not empty. */ + - Removing a directory on a Samba drive using an old Samba version + sometimes doesn't return an error, if the directory can't be removed + because it's not empty. */ if (isremote ()) { OBJECT_ATTRIBUTES attr; FILE_BASIC_INFORMATION fbi; + NTSTATUS q_status; - if (NT_SUCCESS (NtQueryAttributesFile - (pc.get_object_attr (attr, sec_none_nih), &fbi))) - status = STATUS_DIRECTORY_NOT_EMPTY; - else + q_status = NtQueryAttributesFile (pc.get_object_attr (attr, sec_none_nih), &fbi); + if (!NT_SUCCESS (status) && q_status == STATUS_OBJECT_NAME_NOT_FOUND) status = STATUS_SUCCESS; + else if (NT_SUCCESS (status) && NT_SUCCESS (q_status)) + status = STATUS_DIRECTORY_NOT_EMPTY; } if (!NT_SUCCESS (status)) {