Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/ntdll/tests/file.c | 4 ++-- server/fd.c | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c index e0d4580ae04..bb4bf9df8ad 100644 --- a/dlls/ntdll/tests/file.c +++ b/dlls/ntdll/tests/file.c @@ -2123,8 +2123,8 @@ static void test_file_rename_information(void)
U(io).Status = 0xdeadbeef; res = pNtSetInformationFile( handle, &io, fri, sizeof(FILE_RENAME_INFORMATION) + fri->FileNameLength, FileRenameInformation ); - todo_wine ok( U(io).Status == STATUS_SUCCESS, "got io status %#x\n", U(io).Status ); - todo_wine ok( res == STATUS_SUCCESS, "got status %x\n", res ); + ok( U(io).Status == STATUS_SUCCESS, "got io status %#x\n", U(io).Status ); + ok( res == STATUS_SUCCESS, "got status %x\n", res ); ok( GetFileAttributesW( oldpath ) != INVALID_FILE_ATTRIBUTES, "file should exist\n" );
CloseHandle( handle ); diff --git a/server/fd.c b/server/fd.c index c2cb3c96ac6..9a3f68b10c9 100644 --- a/server/fd.c +++ b/server/fd.c @@ -2328,7 +2328,7 @@ static void set_fd_name( struct fd *fd, struct fd *root, const char *nameptr, data_size_t len, int create_link, int replace ) { struct inode *inode; - struct stat st; + struct stat st, st2; char *name;
if (!fd->inode || !fd->unix_name) @@ -2367,6 +2367,13 @@ static void set_fd_name( struct fd *fd, struct fd *root, const char *nameptr,
if (!stat( name, &st )) { + if (fd->unix_fd != 1 && !fstat( fd->unix_fd, &st2 ) && + st.st_ino == st2.st_ino && st.st_dev == st2.st_dev) + { + free( name ); + return; + } + if (!replace) { set_error( STATUS_OBJECT_NAME_COLLISION );