From: Elizabeth Figura zfigura@codeweavers.com
--- dlls/ntdll/unix/file.c | 3 --- 1 file changed, 3 deletions(-)
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index 429f8839ed2..e521dd44686 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -6120,7 +6120,6 @@ NTSTATUS WINAPI NtDeviceIoControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUT case FILE_DEVICE_BEEP: case FILE_DEVICE_NETWORK: status = sock_ioctl( handle, event, apc, apc_context, io, code, in_buffer, in_size, out_buffer, out_size ); - if (status != STATUS_NOT_SUPPORTED && status != STATUS_BAD_DEVICE_TYPE) return status; break; case FILE_DEVICE_DISK: case FILE_DEVICE_CD_ROM: @@ -6143,8 +6142,6 @@ NTSTATUS WINAPI NtDeviceIoControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUT if (status == STATUS_NOT_SUPPORTED || status == STATUS_BAD_DEVICE_TYPE) return server_ioctl_file( handle, event, apc, apc_context, io, code, in_buffer, in_size, out_buffer, out_size ); - - if (status != STATUS_PENDING && !NT_ERROR(status)) io->Status = status; return status; }
From: Elizabeth Figura zfigura@codeweavers.com
Synchronous NT_ERROR conditions should not touch the IOSB or signal completion. --- dlls/ntdll/unix/cdrom.c | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-)
diff --git a/dlls/ntdll/unix/cdrom.c b/dlls/ntdll/unix/cdrom.c index 45b61d54d05..427e559968f 100644 --- a/dlls/ntdll/unix/cdrom.c +++ b/dlls/ntdll/unix/cdrom.c @@ -2822,18 +2822,13 @@ NTSTATUS cdrom_DeviceIoControl( HANDLE device, HANDLE event, PIO_APC_ROUTINE apc
TRACE( "%p %s %p %d %p %d %p\n", device, iocodex(code), in_buffer, in_size, out_buffer, out_size, io );
- io->Information = 0; - if ((status = server_get_unix_fd( device, 0, &fd, &needs_close, NULL, NULL ))) - { - if (status == STATUS_BAD_DEVICE_TYPE) return status; /* no associated fd */ - goto error; - } + return status;
if ((status = CDROM_Open(fd, &dev))) { if (needs_close) close( fd ); - goto error; + return status; }
#ifdef __APPLE__ @@ -2847,16 +2842,13 @@ NTSTATUS cdrom_DeviceIoControl( HANDLE device, HANDLE event, PIO_APC_ROUTINE apc * Also for some reason it wants the fd to be closed before we even * open the parent if we're trying to eject the disk. */ - if ((status = get_parent_device( fd, name, sizeof(name) ))) goto error; + if ((status = get_parent_device( fd, name, sizeof(name) ))) return status; if (code == IOCTL_STORAGE_EJECT_MEDIA) NtClose( device ); if (needs_close) close( fd ); TRACE("opening parent %s\n", name ); if ((fd = open( name, O_RDONLY )) == -1) - { - status = errno_to_status( errno ); - goto error; - } + return errno_to_status( errno ); needs_close = 1; } #endif @@ -3117,13 +3109,14 @@ NTSTATUS cdrom_DeviceIoControl( HANDLE device, HANDLE event, PIO_APC_ROUTINE apc break;
default: - if (needs_close) close( fd ); - return STATUS_NOT_SUPPORTED; + status = STATUS_NOT_SUPPORTED; } if (needs_close) close( fd ); - error: - io->Status = status; - io->Information = sz; - if (event) NtSetEvent(event, NULL); + if (!NT_ERROR(status)) + { + io->Status = status; + io->Information = sz; + if (event) NtSetEvent(event, NULL); + } return status; }
From: Elizabeth Figura zfigura@codeweavers.com
We should never fill the IOSB or signal completion for NT_ERROR conditions. --- dlls/ntdll/unix/serial.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/dlls/ntdll/unix/serial.c b/dlls/ntdll/unix/serial.c index ea9931d891a..a8abee6eeb6 100644 --- a/dlls/ntdll/unix/serial.c +++ b/dlls/ntdll/unix/serial.c @@ -1261,14 +1261,12 @@ NTSTATUS serial_DeviceIoControl( HANDLE device, HANDLE event, PIO_APC_ROUTINE ap return STATUS_NOT_SUPPORTED; }
- io->Information = 0; - - if ((status = server_get_unix_fd( device, access, &fd, &needs_close, &type, NULL ))) goto error; + if ((status = server_get_unix_fd( device, access, &fd, &needs_close, &type, NULL ))) + return status; if (type != FD_TYPE_SERIAL) { if (needs_close) close( fd ); - status = STATUS_OBJECT_TYPE_MISMATCH; - goto error; + return STATUS_OBJECT_TYPE_MISMATCH; }
switch (code) @@ -1455,11 +1453,15 @@ NTSTATUS serial_DeviceIoControl( HANDLE device, HANDLE event, PIO_APC_ROUTINE ap status = STATUS_INVALID_PARAMETER; break; } + if (needs_close) close( fd ); - error: - io->Status = status; - io->Information = sz; - if (event) NtSetEvent(event, NULL); + + if (!NT_ERROR(status)) + { + io->Status = status; + io->Information = sz; + if (event) NtSetEvent(event, NULL); + } return status; }
From: Elizabeth Figura zfigura@codeweavers.com
We should never fill the IOSB or signal completion for NT_ERROR conditions. --- dlls/ntdll/unix/tape.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/dlls/ntdll/unix/tape.c b/dlls/ntdll/unix/tape.c index 48807dbca7a..f513e558898 100644 --- a/dlls/ntdll/unix/tape.c +++ b/dlls/ntdll/unix/tape.c @@ -528,9 +528,8 @@ NTSTATUS tape_DeviceIoControl( HANDLE device, HANDLE event, PIO_APC_ROUTINE apc, TRACE( "%p %s %p %d %p %d %p\n", device, io2str(code), in_buffer, in_size, out_buffer, out_size, io );
- io->Information = 0; - - if ((status = server_get_unix_fd( device, 0, &fd, &needs_close, NULL, NULL ))) goto error; + if ((status = server_get_unix_fd( device, 0, &fd, &needs_close, NULL, NULL ))) + return status;
switch (code) { @@ -580,9 +579,11 @@ NTSTATUS tape_DeviceIoControl( HANDLE device, HANDLE event, PIO_APC_ROUTINE apc,
if (needs_close) close( fd );
-error: - io->Status = status; - io->Information = sz; - if (event) NtSetEvent( event, NULL ); + if (!NT_ERROR(status)) + { + io->Status = status; + io->Information = sz; + if (event) NtSetEvent( event, NULL ); + } return status; }
From: Elizabeth Figura zfigura@codeweavers.com
--- dlls/ntdll/unix/file.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index e521dd44686..c128e8aa369 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -6225,14 +6225,12 @@ NTSTATUS WINAPI NtFsControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE ap } else { - io->Information = 0; status = STATUS_BUFFER_TOO_SMALL; } break; }
case FSCTL_GET_REPARSE_POINT: - io->Information = 0; if (out_buffer && out_size) { FIXME("FSCTL_GET_REPARSE_POINT semi-stub\n"); @@ -6247,7 +6245,6 @@ NTSTATUS WINAPI NtFsControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE ap int fd, needs_close; struct stat st;
- io->Information = 0; if (out_size >= sizeof(*info)) { status = server_get_unix_fd( handle, 0, &fd, &needs_close, NULL, NULL ); @@ -6273,7 +6270,7 @@ NTSTATUS WINAPI NtFsControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE ap in_buffer, in_size, out_buffer, out_size ); }
- if (status != STATUS_PENDING) io->Status = status; + if (!NT_ERROR(status) && status != STATUS_PENDING) io->Status = status; return status; }