* syscalls.cc (unlink_nt): Fix a bug which overwrites the NT status

value in case setting the delete disposition returns with
	STATUS_DIRECTORY_NOT_EMPTY.
This commit is contained in:
Corinna Vinschen 2011-10-24 14:02:32 +00:00
parent b3480fbefb
commit 53e93974c8
2 changed files with 14 additions and 6 deletions

View File

@ -1,3 +1,9 @@
2011-10-24 Corinna Vinschen <corinna@vinschen.de>
* syscalls.cc (unlink_nt): Fix a bug which overwrites the NT status
value in case setting the delete disposition returns with
STATUS_DIRECTORY_NOT_EMPTY.
2011-10-24 Corinna Vinschen <corinna@vinschen.de> 2011-10-24 Corinna Vinschen <corinna@vinschen.de>
* shared.cc (open_shared): Fix memory reservation of essential shared * shared.cc (open_shared): Fix memory reservation of essential shared

View File

@ -695,20 +695,22 @@ unlink_nt (path_conv &pc)
{ {
debug_printf ("Setting delete disposition on %S failed, status = %p", debug_printf ("Setting delete disposition on %S failed, status = %p",
pc.get_nt_native_path (), status); pc.get_nt_native_path (), status);
if (status == STATUS_DIRECTORY_NOT_EMPTY) if (strace.active () && status == STATUS_DIRECTORY_NOT_EMPTY)
{ {
NTSTATUS status2;
pc.get_object_attr (attr, sec_none_nih); pc.get_object_attr (attr, sec_none_nih);
NtClose (fh); NtClose (fh);
status = NtOpenFile (&fh, access | FILE_LIST_DIRECTORY | SYNCHRONIZE, status2 = NtOpenFile (&fh, access | FILE_LIST_DIRECTORY | SYNCHRONIZE,
&attr, &io, FILE_SHARE_VALID_FLAGS, &attr, &io, FILE_SHARE_VALID_FLAGS,
flags | FILE_SYNCHRONOUS_IO_NONALERT); flags | FILE_SYNCHRONOUS_IO_NONALERT);
if (NT_SUCCESS (status)) if (NT_SUCCESS (status2))
check_dir_not_empty (fh, pc); check_dir_not_empty (fh, pc);
else else
{ {
fh = NULL; fh = NULL;
debug_printf ("Opening dir %S for check_dir_not_empty failed, " debug_printf ("Opening dir %S for check_dir_not_empty failed, "
"status = %p", pc.get_nt_native_path (), status); "status = %p", pc.get_nt_native_path (), status2);
} }
} }
/* Trying to delete a hardlink to a file in use by the system in some /* Trying to delete a hardlink to a file in use by the system in some