From: Michel Zou xantares09@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
I did not test this, just mimic what you did in 3fd47b4663af18d815f85f50c9f343bb6aca7066 for https://bugs.winehq.org/show_bug.cgi?id=53677
cc @piotr
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.
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
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.