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
5a313234
Commit
5a313234
authored
Jan 14, 2008
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Close the stdio handles when creating a detached process.
parent
9a1b6264
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
2 deletions
+33
-2
process.c
dlls/kernel32/process.c
+33
-2
No files found.
dlls/kernel32/process.c
View file @
5a313234
...
...
@@ -1189,7 +1189,23 @@ static int fork_and_exec( const char *filename, const WCHAR *cmdline,
char
**
envp
=
build_envp
(
env
);
close
(
fd
[
0
]
);
if
(
flags
&
(
CREATE_NEW_PROCESS_GROUP
|
CREATE_NEW_CONSOLE
|
DETACHED_PROCESS
))
setsid
();
if
(
flags
&
(
CREATE_NEW_PROCESS_GROUP
|
CREATE_NEW_CONSOLE
|
DETACHED_PROCESS
))
{
int
pid
;
if
(
!
(
pid
=
fork
()))
{
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
(
pid
!=
-
1
)
_exit
(
0
);
/* parent */
}
/* Reset signals that we previously set to SIG_IGN */
signal
(
SIGPIPE
,
SIG_DFL
);
...
...
@@ -1410,7 +1426,22 @@ static BOOL create_process( HANDLE hFile, LPCWSTR filename, LPWSTR cmd_line, LPW
char
preloader_reserve
[
64
],
socket_env
[
64
];
char
**
argv
=
build_argv
(
cmd_line
,
1
);
if
(
flags
&
(
CREATE_NEW_PROCESS_GROUP
|
CREATE_NEW_CONSOLE
|
DETACHED_PROCESS
))
setsid
();
if
(
flags
&
(
CREATE_NEW_PROCESS_GROUP
|
CREATE_NEW_CONSOLE
|
DETACHED_PROCESS
))
{
if
(
!
(
pid
=
fork
()))
{
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
(
pid
!=
-
1
)
_exit
(
0
);
/* parent */
}
/* Reset signals that we previously set to SIG_IGN */
signal
(
SIGPIPE
,
SIG_DFL
);
...
...
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