aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2017-07-14 22:25:58 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2017-07-18 19:20:58 +0200
commit1f684bcde457d41f2dcb4451df27323924e13b68 (patch)
tree025ebb3515e670dd7caf39906a86abe4fddf26b9
parent2cb72bb8de5587d0c6a9f1065f41aee962f196d4 (diff)
downloadbusybox-w32-1f684bcde457d41f2dcb4451df27323924e13b68.tar.gz
busybox-w32-1f684bcde457d41f2dcb4451df27323924e13b68.tar.bz2
busybox-w32-1f684bcde457d41f2dcb4451df27323924e13b68.zip
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>
-rw-r--r--shell/ash.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 2e1d1e7b7..7a11305bd 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -4022,15 +4022,19 @@ sprint_status48(char *s, int status, int sigonly)
4022 4022
4023 col = 0; 4023 col = 0;
4024 if (!WIFEXITED(status)) { 4024 if (!WIFEXITED(status)) {
4025 if (JOBS && WIFSTOPPED(status)) 4025#if JOBS
4026 if (WIFSTOPPED(status))
4026 st = WSTOPSIG(status); 4027 st = WSTOPSIG(status);
4027 else 4028 else
4029#endif
4028 st = WTERMSIG(status); 4030 st = WTERMSIG(status);
4029 if (sigonly) { 4031 if (sigonly) {
4030 if (st == SIGINT || st == SIGPIPE) 4032 if (st == SIGINT || st == SIGPIPE)
4031 goto out; 4033 goto out;
4032 if (JOBS && WIFSTOPPED(status)) 4034#if JOBS
4035 if (WIFSTOPPED(status))
4033 goto out; 4036 goto out;
4037#endif
4034 } 4038 }
4035 st &= 0x7f; 4039 st &= 0x7f;
4036//TODO: use bbox's get_signame? strsignal adds ~600 bytes to text+rodata 4040//TODO: use bbox's get_signame? strsignal adds ~600 bytes to text+rodata
@@ -4182,8 +4186,10 @@ dowait(int block, struct job *job)
4182 goto out; 4186 goto out;
4183 } 4187 }
4184 /* The process wasn't found in job list */ 4188 /* The process wasn't found in job list */
4185 if (JOBS && !WIFSTOPPED(status)) 4189#if JOBS
4190 if (!WIFSTOPPED(status))
4186 jobless--; 4191 jobless--;
4192#endif
4187 out: 4193 out:
4188 INT_ON; 4194 INT_ON;
4189 4195