Module: wine Branch: master Commit: 98b99b65690bbe7779ed01352f757c41dd9e8a34 URL: https://gitlab.winehq.org/wine/wine/-/commit/98b99b65690bbe7779ed01352f757c4...
Author: Elizabeth Figura zfigura@codeweavers.com Date: Fri Jun 24 20:37:32 2022 -0500
ntdll: Do not fill the IOSB or signal completion on failure in serial_DeviceIoControl().
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; }