Compare commits
2 Commits
04446c4586
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 039b49c3fc | |||
|
|
04ce0d643e |
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
config.h
|
||||||
|
st
|
||||||
|
st.o
|
||||||
|
x.o
|
||||||
21
st.c
21
st.c
@@ -712,19 +712,24 @@ execsh(char *cmd, char **args)
|
|||||||
void
|
void
|
||||||
sigchld(int a)
|
sigchld(int a)
|
||||||
{
|
{
|
||||||
int stat;
|
int stat, olderrno;
|
||||||
pid_t p;
|
pid_t p;
|
||||||
|
|
||||||
if ((p = waitpid(pid, &stat, WNOHANG)) < 0)
|
olderrno = errno;
|
||||||
die("waiting for pid %hd failed: %s\n", pid, strerror(errno));
|
do {
|
||||||
|
p = waitpid(pid, &stat, WNOHANG);
|
||||||
|
} while (p < 0 && errno == EINTR);
|
||||||
|
|
||||||
if (pid != p)
|
if (p < 0)
|
||||||
|
_exit(1);
|
||||||
|
|
||||||
|
if (pid != p) {
|
||||||
|
errno = olderrno;
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (WIFEXITED(stat) && WEXITSTATUS(stat))
|
if ((WIFEXITED(stat) && WEXITSTATUS(stat)) || WIFSIGNALED(stat))
|
||||||
die("child exited with status %d\n", WEXITSTATUS(stat));
|
_exit(1);
|
||||||
else if (WIFSIGNALED(stat))
|
|
||||||
die("child terminated due to signal %d\n", WTERMSIG(stat));
|
|
||||||
_exit(0);
|
_exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user