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
fa9af1d0
Commit
fa9af1d0
authored
May 21, 2003
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reset SIGCHLD handler to default if we need to wait. Reset SIGPIPE
handler before exec.
parent
7c836cf9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
6 deletions
+27
-6
spawn.c
libs/port/spawn.c
+27
-6
No files found.
libs/port/spawn.c
View file @
fa9af1d0
...
...
@@ -22,6 +22,7 @@
#include "wine/port.h"
#include <errno.h>
#include <signal.h>
#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif
...
...
@@ -34,19 +35,39 @@ int spawnvp(int mode, const char *cmdname, char *const argv[])
{
#ifndef HAVE__SPAWNVP
int
pid
=
0
,
status
,
wret
;
struct
sigaction
dfl_act
,
old_act
;
if
(
mode
!=
_P_OVERLAY
)
pid
=
fork
();
if
(
pid
==
0
)
pid
=
execvp
(
argv
[
0
],
argv
);
if
(
pid
<
0
)
return
-
1
;
if
(
mode
==
_P_OVERLAY
)
{
execvp
(
cmdname
,
argv
);
return
-
1
;
/* if we get here it failed */
}
if
(
mode
!=
_P_WAIT
)
return
pid
;
dfl_act
.
sa_handler
=
SIG_DFL
;
dfl_act
.
sa_flags
=
0
;
sigemptyset
(
&
dfl_act
.
sa_mask
);
if
(
mode
==
_P_WAIT
)
sigaction
(
SIGCHLD
,
&
dfl_act
,
&
old_act
);
pid
=
fork
();
if
(
pid
==
0
)
{
sigaction
(
SIGPIPE
,
&
dfl_act
,
NULL
);
execvp
(
cmdname
,
argv
);
_exit
(
1
);
}
if
(
pid
!=
-
1
&&
mode
==
_P_WAIT
)
{
while
(
pid
!=
(
wret
=
waitpid
(
pid
,
&
status
,
0
)))
if
(
wret
==
-
1
&&
errno
!=
EINTR
)
break
;
if
(
pid
==
wret
&&
WIFEXITED
(
status
))
return
WEXITSTATUS
(
status
);
if
(
pid
==
wret
&&
WIFEXITED
(
status
))
pid
=
WEXITSTATUS
(
status
);
else
pid
=
255
;
/* abnormal exit with an abort or an interrupt */
}
return
255
;
/* abnormal exit with an abort or an interrupt */
if
(
mode
==
_P_WAIT
)
sigaction
(
SIGCHLD
,
&
old_act
,
NULL
);
return
pid
;
#else
/* HAVE__SPAWNVP */
return
_spawnvp
(
mode
,
cmdname
,
argv
);
#endif
/* HAVE__SPAWNVP */
...
...
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