mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-06 08:39:34 +00:00
msvcrt: Fix errno set on dup from read-only file.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53950
This commit is contained in:
parent
7ca1eff8e1
commit
53bc6c7a4a
|
@ -1244,6 +1244,7 @@ int CDECL _dup2(int od, int nd)
|
|||
|
||||
if (info_nd == &MSVCRT___badioinfo)
|
||||
{
|
||||
*_errno() = EBADF;
|
||||
ret = -1;
|
||||
}
|
||||
else if (info_od->wxflag & WX_OPEN)
|
||||
|
|
|
@ -267,6 +267,12 @@ static void test_readmode( BOOL ascii_mode )
|
|||
|
||||
close (fd);
|
||||
|
||||
fd = open ("fdopen.tst", O_RDONLY, _S_IREAD |_S_IWRITE);
|
||||
errno = 0xdeadbeef;
|
||||
ok(dup2(fd, -1) == -1, "dup2(fd, -1) succeeded\n");
|
||||
ok(errno == EBADF, "errno = %d\n", errno);
|
||||
close (fd);
|
||||
|
||||
if (ascii_mode) {
|
||||
/* Open file in ascii mode */
|
||||
fd = open ("fdopen.tst", O_RDONLY);
|
||||
|
|
Loading…
Reference in a new issue