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
7f5f904c
Commit
7f5f904c
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 write to read-only file.
parent
3fd47b46
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
0 deletions
+10
-0
file.c
dlls/msvcrt/file.c
+4
-0
file.c
dlls/msvcrt/tests/file.c
+6
-0
No files found.
dlls/msvcrt/file.c
View file @
7f5f904c
...
...
@@ -3590,6 +3590,8 @@ int CDECL _write(int fd, const void* buf, unsigned int count)
TRACE
(
"WriteFile (fd %d, hand %p) failed-last error (%ld)
\n
"
,
fd
,
hand
,
GetLastError
());
msvcrt_set_errno
(
GetLastError
());
if
(
GetLastError
()
==
ERROR_ACCESS_DENIED
)
*
_errno
()
=
EBADF
;
num_written
=
-
1
;
}
...
...
@@ -3718,6 +3720,8 @@ int CDECL _write(int fd, const void* buf, unsigned int count)
TRACE
(
"WriteFile/WriteConsoleW (fd %d, hand %p) failed-last error (%ld)
\n
"
,
fd
,
hand
,
GetLastError
());
msvcrt_set_errno
(
GetLastError
());
if
(
GetLastError
()
==
ERROR_ACCESS_DENIED
)
*
_errno
()
=
EBADF
;
release_ioinfo
(
info
);
return
-
1
;
}
...
...
dlls/msvcrt/tests/file.c
View file @
7f5f904c
...
...
@@ -311,6 +311,12 @@ static void test_readmode( BOOL ascii_mode )
ok
(
l
==
pl
+
fp
,
"line 2 ftell got %ld should be %d in %s
\n
"
,
l
,
pl
+
fp
,
IOMODE
);
ok
(
lstrlenA
(
buffer
)
==
2
+
ao
,
"line 2 fgets got size %d should be %d in %s
\n
"
,
lstrlenA
(
buffer
),
2
+
ao
,
IOMODE
);
errno
=
0xdeadbeef
;
_doserrno
=
0xdeadbeef
;
ok
(
write
(
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
);
/* test fread across buffer boundary */
rewind
(
file
);
...
...
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