[PATCH v2 0/1] MR10846: msvcrt!_commit: Set errno in failure path
Set `EBADF` when an invalid input `fd` is passed to `_commit` -- v2: msvcrt: Set errno in failure path https://gitlab.winehq.org/wine/wine/-/merge_requests/10846
From: Luca Bacci <luca.bacci@outlook.com> --- dlls/msvcrt/file.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c index b1eb86c42c7..e5850ecf030 100644 --- a/dlls/msvcrt/file.c +++ b/dlls/msvcrt/file.c @@ -1117,7 +1117,10 @@ int CDECL _commit(int fd) TRACE(":fd (%d) handle (%p)\n", fd, info->handle); if (info->handle == INVALID_HANDLE_VALUE) + { + *_errno() = EBADF; ret = -1; + } else if (!FlushFileBuffers(info->handle)) { if (GetLastError() == ERROR_INVALID_HANDLE) -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10846
This merge request was approved by Piotr Caban. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10846
participants (3)
-
Luca Bacci -
Luca Bacci (@lb90) -
Piotr Caban (@piotr)