aboutsummaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2019-04-04 08:12:58 +0100
committerRon Yorston <rmy@pobox.com>2019-04-04 08:12:58 +0100
commitf17dd059cbab0a83c677d78475ef1fdf8f5ab59a (patch)
treeb2221c7a9d4ab616ab85e28010903850728c57a5 /shell
parentb990323902ab8c16d84a45e3ed5b319874320d64 (diff)
parenta3ce161363380899ae45716c70714cfcc93a7755 (diff)
downloadbusybox-w32-f17dd059cbab0a83c677d78475ef1fdf8f5ab59a.tar.gz
busybox-w32-f17dd059cbab0a83c677d78475ef1fdf8f5ab59a.tar.bz2
busybox-w32-f17dd059cbab0a83c677d78475ef1fdf8f5ab59a.zip
Merge branch 'busybox' into merge
Diffstat (limited to 'shell')
-rw-r--r--shell/ash.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 6bc1dba24..c4f0880c8 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -258,6 +258,7 @@
258#define BASH_XTRACEFD ENABLE_ASH_BASH_COMPAT 258#define BASH_XTRACEFD ENABLE_ASH_BASH_COMPAT
259#define BASH_READ_D ENABLE_ASH_BASH_COMPAT 259#define BASH_READ_D ENABLE_ASH_BASH_COMPAT
260#define IF_BASH_READ_D IF_ASH_BASH_COMPAT 260#define IF_BASH_READ_D IF_ASH_BASH_COMPAT
261#define BASH_WAIT_N ENABLE_ASH_BASH_COMPAT
261 262
262#if defined(__ANDROID_API__) && __ANDROID_API__ <= 24 263#if defined(__ANDROID_API__) && __ANDROID_API__ <= 24
263/* Bionic at least up to version 24 has no glob() */ 264/* Bionic at least up to version 24 has no glob() */
@@ -4705,7 +4706,7 @@ wait_block_or_sig(int *status)
4705#define DOWAIT_NONBLOCK 0 4706#define DOWAIT_NONBLOCK 0
4706#define DOWAIT_BLOCK 1 4707#define DOWAIT_BLOCK 1
4707#define DOWAIT_BLOCK_OR_SIG 2 4708#define DOWAIT_BLOCK_OR_SIG 2
4708#if ENABLE_ASH_BASH_COMPAT 4709#if BASH_WAIT_N
4709# define DOWAIT_JOBSTATUS 0x10 /* OR this to get job's exitstatus instead of pid */ 4710# define DOWAIT_JOBSTATUS 0x10 /* OR this to get job's exitstatus instead of pid */
4710#endif 4711#endif
4711 4712
@@ -4716,7 +4717,7 @@ dowait(int block, struct job *job)
4716 int status; 4717 int status;
4717 struct job *jp; 4718 struct job *jp;
4718 struct job *thisjob; 4719 struct job *thisjob;
4719#if ENABLE_ASH_BASH_COMPAT 4720#if BASH_WAIT_N
4720 bool want_jobexitstatus = (block & DOWAIT_JOBSTATUS); 4721 bool want_jobexitstatus = (block & DOWAIT_JOBSTATUS);
4721 block = (block & ~DOWAIT_JOBSTATUS); 4722 block = (block & ~DOWAIT_JOBSTATUS);
4722#endif 4723#endif
@@ -4823,7 +4824,7 @@ dowait(int block, struct job *job)
4823 out: 4824 out:
4824 INT_ON; 4825 INT_ON;
4825 4826
4826#if ENABLE_ASH_BASH_COMPAT 4827#if BASH_WAIT_N
4827 if (want_jobexitstatus) { 4828 if (want_jobexitstatus) {
4828 pid = -1; 4829 pid = -1;
4829 if (thisjob && thisjob->state == JOBDONE) 4830 if (thisjob && thisjob->state == JOBDONE)
@@ -5012,7 +5013,7 @@ waitcmd(int argc UNUSED_PARAM, char **argv)
5012 struct job *job; 5013 struct job *job;
5013 int retval; 5014 int retval;
5014 struct job *jp; 5015 struct job *jp;
5015#if ENABLE_ASH_BASH_COMPAT 5016#if BASH_WAIT_N
5016 int status; 5017 int status;
5017 char one = nextopt("n"); 5018 char one = nextopt("n");
5018#else 5019#else
@@ -5025,7 +5026,7 @@ waitcmd(int argc UNUSED_PARAM, char **argv)
5025 /* wait for all jobs / one job if -n */ 5026 /* wait for all jobs / one job if -n */
5026 for (;;) { 5027 for (;;) {
5027 jp = curjob; 5028 jp = curjob;
5028#if ENABLE_ASH_BASH_COMPAT 5029#if BASH_WAIT_N
5029 if (one && !jp) 5030 if (one && !jp)
5030 /* exitcode of "wait -n" with nothing to wait for is 127, not 0 */ 5031 /* exitcode of "wait -n" with nothing to wait for is 127, not 0 */
5031 retval = 127; 5032 retval = 127;
@@ -5045,7 +5046,7 @@ waitcmd(int argc UNUSED_PARAM, char **argv)
5045 * with an exit status greater than 128, immediately after which 5046 * with an exit status greater than 128, immediately after which
5046 * the trap is executed." 5047 * the trap is executed."
5047 */ 5048 */
5048#if ENABLE_ASH_BASH_COMPAT 5049#if BASH_WAIT_N
5049 status = dowait(DOWAIT_BLOCK_OR_SIG | DOWAIT_JOBSTATUS, NULL); 5050 status = dowait(DOWAIT_BLOCK_OR_SIG | DOWAIT_JOBSTATUS, NULL);
5050#else 5051#else
5051 dowait(DOWAIT_BLOCK_OR_SIG, NULL); 5052 dowait(DOWAIT_BLOCK_OR_SIG, NULL);
@@ -5056,7 +5057,7 @@ waitcmd(int argc UNUSED_PARAM, char **argv)
5056 */ 5057 */
5057 if (pending_sig) 5058 if (pending_sig)
5058 goto sigout; 5059 goto sigout;
5059#if ENABLE_ASH_BASH_COMPAT 5060#if BASH_WAIT_N
5060 if (one) { 5061 if (one) {
5061 /* wait -n waits for one _job_, not one _process_. 5062 /* wait -n waits for one _job_, not one _process_.
5062 * date; sleep 3 & sleep 2 | sleep 1 & wait -n; date 5063 * date; sleep 3 & sleep 2 | sleep 1 & wait -n; date