[PATCH 0/1] MR1553: msvcrt: Fix errno set on dup from read-only file.
From: Michel Zou <xantares09(a)hotmail.com> Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53950 --- dlls/msvcrt/file.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c index 4a8c3510bd7..17434ec8ae0 100644 --- a/dlls/msvcrt/file.c +++ b/dlls/msvcrt/file.c @@ -1266,6 +1266,8 @@ int CDECL _dup2(int od, int nd) { ret = -1; msvcrt_set_errno(GetLastError()); + if (GetLastError() == ERROR_ACCESS_DENIED) + *_errno() = EBADF; } } else -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/1553
I did not test this, just mimic what you did in 3fd47b4663af18d815f85f50c9f343bb6aca7066 for https://bugs.winehq.org/show_bug.cgi?id=53677 cc @piotr -- https://gitlab.winehq.org/wine/wine/-/merge_requests/1553#note_17564
Piotr Caban (@piotr) commented about dlls/msvcrt/file.c:
{ ret = -1; msvcrt_set_errno(GetLastError()); + if (GetLastError() == ERROR_ACCESS_DENIED) + *_errno() = EBADF;
In bug you have attached test application. It will not be fixed by this change. errno should be set in ```c if (info_nd == &MSVCRT___badioinfo) { *_errno() = EBADF; ret = -1; } ``` case. Please also add the test to wine. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/1553#note_17573
On Sat Nov 26 19:26:44 2022 +0000, Piotr Caban wrote:
In bug you have attached test application. It will not be fixed by this change. errno should be set in ```c if (info_nd == &MSVCRT___badioinfo) { *_errno() = EBADF; ret = -1; } ``` case. Please also add the test to wine. Maybe different errno should be set in `alloc_pioinfo_block`. This will need some more testing.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/1553#note_17574
participants (3)
-
Michel Zou -
Piotr Caban (@piotr) -
xantares (@xantares)