Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
626f8d75
Commit
626f8d75
authored
Aug 17, 2023
by
Eric Pouech
Committed by
Alexandre Julliard
Aug 17, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Fix freopen() on FILE with invalid underlying fd.
Signed-off-by:
Eric Pouech
<
epouech@codeweavers.com
>
parent
65b6e237
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
3 deletions
+20
-3
file.c
dlls/msvcrt/file.c
+1
-3
file.c
dlls/msvcrt/tests/file.c
+19
-0
No files found.
dlls/msvcrt/file.c
View file @
626f8d75
...
...
@@ -4588,9 +4588,7 @@ FILE* CDECL _wfreopen(const wchar_t *path, const wchar_t *mode, FILE* file)
TRACE
(
":path (%s) mode (%s) file (%p) fd (%d)
\n
"
,
debugstr_w
(
path
),
debugstr_w
(
mode
),
file
,
file
?
file
->
_file
:
-
1
);
LOCK_FILES
();
if
(
!
file
||
((
fd
=
file
->
_file
)
<
0
))
file
=
NULL
;
else
if
(
file
)
{
fclose
(
file
);
if
(
msvcrt_get_flags
(
mode
,
&
open_flags
,
&
stream_flags
)
==
-
1
)
...
...
dlls/msvcrt/tests/file.c
View file @
626f8d75
...
...
@@ -1236,6 +1236,25 @@ static void test_freopen( void )
ok
(
ret
==
EOF
,
"fclose(file) succeeded
\n
"
);
ok
(
errno
==
0xdeadbeef
,
"errno is %d
\n
"
,
errno
);
file
=
fopen
(
filename1
,
"rb"
);
ok
(
file
!=
NULL
,
"couldn't open %s
\n
"
,
filename1
);
close
(
file
->
_file
);
file
->
_file
=
-
1
;
new
=
freopen
(
filename2
,
"rb"
,
file
);
ok
(
new
==
file
,
"freopen() didn't return same FILE*
\n
"
);
fd
=
fileno
(
file
);
ok
(
fd
>
0
,
"fileno() returned %d
\n
"
,
fd
);
ch
=
'#'
;
ret
=
fread
(
&
ch
,
1
,
1
,
file
);
ok
(
ret
==
1
,
"fread() returned %d
\n
"
,
ret
);
ok
(
ch
==
'2'
,
"Unexpected char
\n
"
);
ret
=
fclose
(
file
);
ok
(
ret
==
0
,
"fclose(file) returned %d
\n
"
,
ret
);
unlink
(
filename1
);
unlink
(
filename2
);
}
...
...
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