Signed-off-by: Dmitry Timoshkov dmitry@baikal.ru --- dlls/ntdll/tests/file.c | 10 ---------- server/fd.c | 11 +++++++++++ server/trace.c | 1 + 3 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c index 7a905526b3..81fa7971b3 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 f2d83b4d58..b0a1a1cf75 100644 --- a/server/fd.c +++ b/server/fd.c @@ -1830,6 +1830,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) { @@ -1844,6 +1845,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)) { diff --git a/server/trace.c b/server/trace.c index 9a84067662..c36ecdbef0 100644 --- a/server/trace.c +++ b/server/trace.c @@ -5450,6 +5450,7 @@ static const struct { "CONNECTION_REFUSED", STATUS_CONNECTION_REFUSED }, { "CONNECTION_RESET", STATUS_CONNECTION_RESET }, { "DEBUGGER_INACTIVE", STATUS_DEBUGGER_INACTIVE }, + { "DELETE_PENDING", STATUS_DELETE_PENDING }, { "DEVICE_BUSY", STATUS_DEVICE_BUSY }, { "DIRECTORY_NOT_EMPTY", STATUS_DIRECTORY_NOT_EMPTY }, { "DISK_FULL", STATUS_DISK_FULL },