Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
3fd47b46
Commit
3fd47b46
authored
Nov 02, 2022
by
Piotr Caban
Committed by
Alexandre Julliard
Nov 02, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Fix errno set on read from write-only file.
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=53677
parent
c69f1955
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
0 deletions
+13
-0
file.c
dlls/msvcrt/file.c
+6
-0
file.c
dlls/msvcrt/tests/file.c
+7
-0
No files found.
dlls/msvcrt/file.c
View file @
3fd47b46
...
...
@@ -2756,6 +2756,8 @@ static int read_utf8(ioinfo *fdinfo, wchar_t *buf, unsigned int count)
return
0
;
}
else
{
msvcrt_set_errno
(
GetLastError
());
if
(
GetLastError
()
==
ERROR_ACCESS_DENIED
)
*
_errno
()
=
EBADF
;
return
-
1
;
}
}
else
if
(
!
num_read
)
{
...
...
@@ -2813,6 +2815,8 @@ static int read_utf8(ioinfo *fdinfo, wchar_t *buf, unsigned int count)
return
0
;
}
else
{
msvcrt_set_errno
(
GetLastError
());
if
(
GetLastError
()
==
ERROR_ACCESS_DENIED
)
*
_errno
()
=
EBADF
;
if
(
readbuf
!=
min_buf
)
free
(
readbuf
);
return
-
1
;
}
...
...
@@ -3041,6 +3045,8 @@ static int read_i(int fd, ioinfo *fdinfo, void *buf, unsigned int count)
{
TRACE
(
":failed-last error (%ld)
\n
"
,
GetLastError
());
msvcrt_set_errno
(
GetLastError
());
if
(
GetLastError
()
==
ERROR_ACCESS_DENIED
)
*
_errno
()
=
EBADF
;
return
-
1
;
}
}
...
...
dlls/msvcrt/tests/file.c
View file @
3fd47b46
...
...
@@ -258,6 +258,13 @@ static void test_readmode( BOOL ascii_mode )
write
(
fd
,
&
padbuffer
[
i
],
1
);
write
(
fd
,
nlbuffer
,
strlen
(
nlbuffer
));
write
(
fd
,
outbuffer
,
sizeof
(
outbuffer
));
errno
=
0xdeadbeef
;
_doserrno
=
0xdeadbeef
;
ok
(
read
(
fd
,
buffer
,
1
)
==
-
1
,
"read succeeded on write-only file
\n
"
);
ok
(
errno
==
EBADF
,
"errno = %d
\n
"
,
errno
);
ok
(
_doserrno
==
ERROR_ACCESS_DENIED
,
"doserrno = %ld
\n
"
,
_doserrno
);
close
(
fd
);
if
(
ascii_mode
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment