[PATCH v2 4/6] ntdll: Allow renaming a file to the same name.
Zebediah Figura
zfigura at codeweavers.com
Mon Mar 9 15:45:07 CDT 2020
On 3/9/20 5:01 AM, Alexandre Julliard wrote:
> Zebediah Figura <z.figura12 at gmail.com> writes:
>
>> @@ -2780,8 +2780,29 @@ NTSTATUS WINAPI NtSetInformationFile(HANDLE handle, PIO_STATUS_BLOCK io,
>>
>> if (!info->ReplaceIfExists && io->u.Status == STATUS_SUCCESS)
>> {
>> + struct stat st, st2;
>> + int fd;
>> +
>> + if ((io->u.Status = server_get_unix_fd( handle, 0, &fd, &needs_close, NULL, NULL )))
>> + {
>> + RtlFreeAnsiString( &unix_name );
>> + break;
>> + }
>> +
>> + if (fstat( fd, &st ) < 0 || stat( unix_name.Buffer, &st2 ) < 0)
>> + {
>> + RtlFreeAnsiString( &unix_name );
>> + io->u.Status = FILE_GetNtStatus();
>> + break;
>> + }
>> +
>> + if (st.st_dev == st2.st_dev && st.st_ino == st2.st_ino)
>> + io->u.Status = STATUS_SUCCESS;
>> + else
>> + io->u.Status = STATUS_OBJECT_NAME_COLLISION;
>> +
>> RtlFreeAnsiString( &unix_name );
>> - io->u.Status = STATUS_OBJECT_NAME_COLLISION;
>> + if (needs_close) close( fd );
>
> I feel it would be cleaner to do that on the server side.
>
Sure, will do.
I guess that's necessary anyway, to fix bug 45935...
More information about the wine-devel
mailing list