Signed-off-by: Dmitry Timoshkov dmitry@baikal.ru --- dlls/ntdll/tests/file.c | 10 ---------- server/fd.c | 11 +++++++++++ 2 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c index 4ad2142c51..6793011e7a 100644 --- a/dlls/ntdll/tests/file.c +++ b/dlls/ntdll/tests/file.c @@ -2759,16 +2759,11 @@ todo_wine ok( res == STATUS_DELETE_PENDING, "got %#x\n", res ); /* can't open the deleted file */ handle3 = CreateFileA(buffer, DELETE, FILE_SHARE_DELETE | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0); -todo_wine ok( handle3 == INVALID_HANDLE_VALUE, "CreateFile should fail\n" ); -if (handle3 != INVALID_HANDLE_VALUE) - CloseHandle( handle3 ); -todo_wine ok(GetLastError() == ERROR_ACCESS_DENIED, "got %u\n", GetLastError()); /* can't open the deleted file (wrong sharing mode) */ handle3 = CreateFileA(buffer, DELETE, 0, NULL, OPEN_EXISTING, 0, 0); ok( handle3 == INVALID_HANDLE_VALUE, "CreateFile should fail\n" ); -todo_wine ok(GetLastError() == ERROR_ACCESS_DENIED, "got %u\n", GetLastError()); CloseHandle( handle ); fileDeleted = GetFileAttributesA( buffer ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; @@ -2967,16 +2962,11 @@ todo_wine ok( res == STATUS_DELETE_PENDING, "got %#x\n", res ); /* can't open the deleted directory */ handle3 = CreateFileA(buffer, DELETE, FILE_SHARE_DELETE, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0); -todo_wine ok( handle3 == INVALID_HANDLE_VALUE, "CreateFile should fail\n" ); -todo_wine ok(GetLastError() == ERROR_ACCESS_DENIED, "got %u\n", GetLastError()); -if (handle3 != INVALID_HANDLE_VALUE) - CloseHandle( handle3 ); /* can't open the deleted directory (wrong sharing mode) */ handle3 = CreateFileA(buffer, DELETE, 0, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0); ok( handle3 == INVALID_HANDLE_VALUE, "CreateFile should fail\n" ); -todo_wine ok(GetLastError() == ERROR_ACCESS_DENIED, "got %u\n", GetLastError()); CloseHandle( handle2 ); fileDeleted = GetFileAttributesA( buffer ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; diff --git a/server/fd.c b/server/fd.c index 3737c4d323..346e841e05 100644 --- a/server/fd.c +++ b/server/fd.c @@ -1833,6 +1833,7 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode, { unsigned int err; struct inode *inode = get_inode( st.st_dev, st.st_ino, fd->unix_fd ); + struct list *ptr;
if (!inode) { @@ -1847,6 +1848,16 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode, list_add_head( &inode->open, &fd->inode_entry ); closed_fd = NULL;
+ LIST_FOR_EACH( ptr, &inode->open ) + { + struct fd *fd_ptr = LIST_ENTRY( ptr, struct fd, inode_entry ); + if (fd_ptr->closed->unlink == 1 /* only explicit disposition matters */) + { + set_error( STATUS_DELETE_PENDING ); + goto error; + } + } + /* check directory options */ if ((options & FILE_DIRECTORY_FILE) && !S_ISDIR(st.st_mode)) {