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
6466a17a
Commit
6466a17a
authored
May 07, 2019
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Reset stdio file descriptors when passed invalid handles.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
171dab06
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
13 deletions
+22
-13
process.c
dlls/ntdll/process.c
+22
-13
No files found.
dlls/ntdll/process.c
View file @
6466a17a
...
...
@@ -1034,6 +1034,26 @@ static const char *get_alternate_loader( char **ret_env )
/***********************************************************************
* set_stdio_fd
*/
static
void
set_stdio_fd
(
int
stdin_fd
,
int
stdout_fd
)
{
int
fd
=
-
1
;
if
(
stdin_fd
==
-
1
||
stdout_fd
==
-
1
)
{
fd
=
open
(
"/dev/null"
,
O_RDWR
);
if
(
stdin_fd
==
-
1
)
stdin_fd
=
fd
;
if
(
stdout_fd
==
-
1
)
stdout_fd
=
fd
;
}
dup2
(
stdin_fd
,
0
);
dup2
(
stdout_fd
,
1
);
if
(
fd
!=
-
1
)
close
(
fd
);
}
/***********************************************************************
* spawn_loader
*/
static
NTSTATUS
spawn_loader
(
const
RTL_USER_PROCESS_PARAMETERS
*
params
,
int
socketfd
,
...
...
@@ -1066,21 +1086,10 @@ static NTSTATUS spawn_loader( const RTL_USER_PROCESS_PARAMETERS *params, int soc
params
->
ConsoleHandle
==
(
HANDLE
)
1
/* KERNEL32_CONSOLE_ALLOC */
||
(
params
->
hStdInput
==
INVALID_HANDLE_VALUE
&&
params
->
hStdOutput
==
INVALID_HANDLE_VALUE
))
{
int
fd
=
open
(
"/dev/null"
,
O_RDWR
);
setsid
();
/* close stdin and stdout */
if
(
fd
!=
-
1
)
{
dup2
(
fd
,
0
);
dup2
(
fd
,
1
);
close
(
fd
);
}
}
else
{
if
(
stdin_fd
!=
-
1
)
dup2
(
stdin_fd
,
0
);
if
(
stdout_fd
!=
-
1
)
dup2
(
stdout_fd
,
1
);
set_stdio_fd
(
-
1
,
-
1
);
/* close stdin and stdout */
}
else
set_stdio_fd
(
stdin_fd
,
stdout_fd
);
if
(
stdin_fd
!=
-
1
)
close
(
stdin_fd
);
if
(
stdout_fd
!=
-
1
)
close
(
stdout_fd
);
...
...
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