ash: protect WIFSTOPPED use with #if JOBS
This change fixes the build in setups where there are
no headers defining WIFSTOPPED and WSTOPSIG (where JOBS has to be
set to 0).
This partially reverts 4700fb5be
(ash: make dowait() a bit more
readable. Logic is unchanged, 2015-10-09).
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
7d7c7bb220
commit
9d4dc84a76
12
shell/ash.c
12
shell/ash.c
@ -4022,15 +4022,19 @@ sprint_status48(char *s, int status, int sigonly)
|
|||||||
|
|
||||||
col = 0;
|
col = 0;
|
||||||
if (!WIFEXITED(status)) {
|
if (!WIFEXITED(status)) {
|
||||||
if (JOBS && WIFSTOPPED(status))
|
#if JOBS
|
||||||
|
if (WIFSTOPPED(status))
|
||||||
st = WSTOPSIG(status);
|
st = WSTOPSIG(status);
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
st = WTERMSIG(status);
|
st = WTERMSIG(status);
|
||||||
if (sigonly) {
|
if (sigonly) {
|
||||||
if (st == SIGINT || st == SIGPIPE)
|
if (st == SIGINT || st == SIGPIPE)
|
||||||
goto out;
|
goto out;
|
||||||
if (JOBS && WIFSTOPPED(status))
|
#if JOBS
|
||||||
|
if (WIFSTOPPED(status))
|
||||||
goto out;
|
goto out;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
st &= 0x7f;
|
st &= 0x7f;
|
||||||
//TODO: use bbox's get_signame? strsignal adds ~600 bytes to text+rodata
|
//TODO: use bbox's get_signame? strsignal adds ~600 bytes to text+rodata
|
||||||
@ -4182,8 +4186,10 @@ dowait(int block, struct job *job)
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
/* The process wasn't found in job list */
|
/* The process wasn't found in job list */
|
||||||
if (JOBS && !WIFSTOPPED(status))
|
#if JOBS
|
||||||
|
if (!WIFSTOPPED(status))
|
||||||
jobless--;
|
jobless--;
|
||||||
|
#endif
|
||||||
out:
|
out:
|
||||||
INT_ON;
|
INT_ON;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user