* syscalls.cc (rename): Close oldpath file handle immediately after
trying to rename it. Use nfh handle when checking for non-empty newpath directory. Only change status if check_dir_not_empty really returns STATUS_DIRECTORY_NOT_EMPTY.
This commit is contained in:
parent
14e7bcfdc4
commit
7d5f6c1887
@ -1,3 +1,10 @@
|
|||||||
|
2007-08-09 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* syscalls.cc (rename): Close oldpath file handle immediately after
|
||||||
|
trying to rename it. Use nfh handle when checking for non-empty
|
||||||
|
newpath directory. Only change status if check_dir_not_empty really
|
||||||
|
returns STATUS_DIRECTORY_NOT_EMPTY.
|
||||||
|
|
||||||
2007-08-02 Corinna Vinschen <corinna@vinschen.de>
|
2007-08-02 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* fhandler_disk_file.cc (readdir_get_ino): Accommodate native symlinks.
|
* fhandler_disk_file.cc (readdir_get_ino): Accommodate native symlinks.
|
||||||
|
@ -806,6 +806,7 @@ extern "C"
|
|||||||
BOOLEAN);
|
BOOLEAN);
|
||||||
LONG NTAPI RtlCompareUnicodeString (PUNICODE_STRING, PUNICODE_STRING,
|
LONG NTAPI RtlCompareUnicodeString (PUNICODE_STRING, PUNICODE_STRING,
|
||||||
BOOLEAN);
|
BOOLEAN);
|
||||||
|
NTSTATUS NTAPI RtlConvertSidToUnicodeString (PUNICODE_STRING, PSID, BOOLEAN);
|
||||||
VOID NTAPI RtlCopyUnicodeString (PUNICODE_STRING, PUNICODE_STRING);
|
VOID NTAPI RtlCopyUnicodeString (PUNICODE_STRING, PUNICODE_STRING);
|
||||||
ULONG WINAPI RtlCreateUnicodeStringFromAsciiz (PUNICODE_STRING, PCSTR);
|
ULONG WINAPI RtlCreateUnicodeStringFromAsciiz (PUNICODE_STRING, PCSTR);
|
||||||
BOOLEAN NTAPI RtlEqualUnicodeString (PUNICODE_STRING, PUNICODE_STRING,
|
BOOLEAN NTAPI RtlEqualUnicodeString (PUNICODE_STRING, PUNICODE_STRING,
|
||||||
@ -815,6 +816,7 @@ extern "C"
|
|||||||
VOID NTAPI RtlFreeUnicodeString (PUNICODE_STRING);
|
VOID NTAPI RtlFreeUnicodeString (PUNICODE_STRING);
|
||||||
VOID NTAPI RtlInitEmptyUnicodeString (PUNICODE_STRING, PCWSTR, USHORT);
|
VOID NTAPI RtlInitEmptyUnicodeString (PUNICODE_STRING, PCWSTR, USHORT);
|
||||||
VOID NTAPI RtlInitUnicodeString (PUNICODE_STRING, PCWSTR);
|
VOID NTAPI RtlInitUnicodeString (PUNICODE_STRING, PCWSTR);
|
||||||
|
NTSTATUS NTAPI RtlIntegerToUnicodeString (ULONG, ULONG, PUNICODE_STRING);
|
||||||
ULONG NTAPI RtlIsDosDeviceName_U (PCWSTR);
|
ULONG NTAPI RtlIsDosDeviceName_U (PCWSTR);
|
||||||
ULONG NTAPI RtlNtStatusToDosError (NTSTATUS);
|
ULONG NTAPI RtlNtStatusToDosError (NTSTATUS);
|
||||||
NTSTATUS NTAPI RtlOemStringToUnicodeString (PUNICODE_STRING, POEM_STRING,
|
NTSTATUS NTAPI RtlOemStringToUnicodeString (PUNICODE_STRING, POEM_STRING,
|
||||||
|
@ -1577,6 +1577,7 @@ rename (const char *oldpath, const char *newpath)
|
|||||||
memcpy (&pfri->FileName, dstpc->get_nt_native_path ()->Buffer,
|
memcpy (&pfri->FileName, dstpc->get_nt_native_path ()->Buffer,
|
||||||
pfri->FileNameLength);
|
pfri->FileNameLength);
|
||||||
status = NtSetInformationFile (fh, &io, pfri, size, FileRenameInformation);
|
status = NtSetInformationFile (fh, &io, pfri, size, FileRenameInformation);
|
||||||
|
NtClose (fh);
|
||||||
if (NT_SUCCESS (status))
|
if (NT_SUCCESS (status))
|
||||||
{
|
{
|
||||||
if (removepc)
|
if (removepc)
|
||||||
@ -1589,18 +1590,18 @@ rename (const char *oldpath, const char *newpath)
|
|||||||
whether we tried to rename to an existing non-empty dir.
|
whether we tried to rename to an existing non-empty dir.
|
||||||
In this case we have to set errno to EEXIST. */
|
In this case we have to set errno to EEXIST. */
|
||||||
if (status == STATUS_ACCESS_DENIED && dstpc->isdir ()
|
if (status == STATUS_ACCESS_DENIED && dstpc->isdir ()
|
||||||
&& NT_SUCCESS (NtOpenFile (&fh, FILE_LIST_DIRECTORY | SYNCHRONIZE,
|
&& NT_SUCCESS (NtOpenFile (&nfh, FILE_LIST_DIRECTORY | SYNCHRONIZE,
|
||||||
dstpc->get_object_attr (attr, sec_none_nih),
|
dstpc->get_object_attr (attr, sec_none_nih),
|
||||||
&io, FILE_SHARE_VALID_FLAGS,
|
&io, FILE_SHARE_VALID_FLAGS,
|
||||||
FILE_OPEN_FOR_BACKUP_INTENT
|
FILE_OPEN_FOR_BACKUP_INTENT
|
||||||
| FILE_SYNCHRONOUS_IO_NONALERT)))
|
| FILE_SYNCHRONOUS_IO_NONALERT)))
|
||||||
{
|
{
|
||||||
status = check_dir_not_empty (fh);
|
if (check_dir_not_empty (nfh) == STATUS_DIRECTORY_NOT_EMPTY)
|
||||||
NtClose (fh);
|
status = STATUS_DIRECTORY_NOT_EMPTY;
|
||||||
|
NtClose (nfh);
|
||||||
}
|
}
|
||||||
__seterrno_from_nt_status (status);
|
__seterrno_from_nt_status (status);
|
||||||
}
|
}
|
||||||
NtClose (fh);
|
|
||||||
|
|
||||||
out:
|
out:
|
||||||
syscall_printf ("%d = rename (%s, %s)", res, oldpath, newpath);
|
syscall_printf ("%d = rename (%s, %s)", res, oldpath, newpath);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user