* fhandler_disk_file.cc (fhandler_disk_file::rmdir): More thoroughly

check the existence condition on remote drives.  Enhance comment.
This commit is contained in:
Corinna Vinschen 2010-09-11 10:58:42 +00:00
parent 0f81b5d4bc
commit 99544f92a0
2 changed files with 13 additions and 6 deletions

View File

@ -1,3 +1,8 @@
2010-09-11 Corinna Vinschen <corinna@vinschen.de>
* fhandler_disk_file.cc (fhandler_disk_file::rmdir): More thoroughly
check the existence condition on remote drives. Enhance comment.
2010-09-11 Dave Korn <dave.korn.cygwin@gmail.com> 2010-09-11 Dave Korn <dave.korn.cygwin@gmail.com>
* Makefile.in (DLL_OFILES): Add new fenv.o module. * Makefile.in (DLL_OFILES): Add new fenv.o module.

View File

@ -1609,18 +1609,20 @@ fhandler_disk_file::rmdir ()
/* Check for existence of remote dirs after trying to delete them. /* Check for existence of remote dirs after trying to delete them.
Two reasons: Two reasons:
- Sometimes SMB indicates failure when it really succeeds. - Sometimes SMB indicates failure when it really succeeds.
- Removeing a directory on a samba drive doesn't return an error if the - Removing a directory on a Samba drive using an old Samba version
directory can't be removed because it's not empty. */ sometimes doesn't return an error, if the directory can't be removed
because it's not empty. */
if (isremote ()) if (isremote ())
{ {
OBJECT_ATTRIBUTES attr; OBJECT_ATTRIBUTES attr;
FILE_BASIC_INFORMATION fbi; FILE_BASIC_INFORMATION fbi;
NTSTATUS q_status;
if (NT_SUCCESS (NtQueryAttributesFile q_status = NtQueryAttributesFile (pc.get_object_attr (attr, sec_none_nih), &fbi);
(pc.get_object_attr (attr, sec_none_nih), &fbi))) if (!NT_SUCCESS (status) && q_status == STATUS_OBJECT_NAME_NOT_FOUND)
status = STATUS_DIRECTORY_NOT_EMPTY;
else
status = STATUS_SUCCESS; status = STATUS_SUCCESS;
else if (NT_SUCCESS (status) && NT_SUCCESS (q_status))
status = STATUS_DIRECTORY_NOT_EMPTY;
} }
if (!NT_SUCCESS (status)) if (!NT_SUCCESS (status))
{ {