aboutsummaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-05-17 04:42:40 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2010-05-17 04:42:40 +0200
commit7c1ed9fbdedb6cd038df11322a82ac7aea412524 (patch)
treee247d2978011c7c27cb9a3469e02bce17c3dca68 /shell
parent9963fe36c2af2bf99fcbd2eae6e9e050c8cf779b (diff)
downloadbusybox-w32-7c1ed9fbdedb6cd038df11322a82ac7aea412524.tar.gz
busybox-w32-7c1ed9fbdedb6cd038df11322a82ac7aea412524.tar.bz2
busybox-w32-7c1ed9fbdedb6cd038df11322a82ac7aea412524.zip
ash: fix signal5.tests
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell')
-rw-r--r--shell/ash.c17
-rwxr-xr-xshell/ash_test/ash-signals/signal5.tests1
2 files changed, 12 insertions, 6 deletions
diff --git a/shell/ash.c b/shell/ash.c
index ec5e0b8c7..ef22da1b6 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -3874,9 +3874,9 @@ dowait(int wait_flags, struct job *job)
3874} 3874}
3875 3875
3876static int 3876static int
3877blocking_wait_with_raise_on_sig(struct job *job) 3877blocking_wait_with_raise_on_sig(void)
3878{ 3878{
3879 pid_t pid = dowait(DOWAIT_BLOCK, job); 3879 pid_t pid = dowait(DOWAIT_BLOCK, NULL);
3880 if (pid <= 0 && pending_sig) 3880 if (pid <= 0 && pending_sig)
3881 raise_exception(EXSIG); 3881 raise_exception(EXSIG);
3882 return pid; 3882 return pid;
@@ -4069,14 +4069,21 @@ waitcmd(int argc UNUSED_PARAM, char **argv)
4069 jp->waited = 1; 4069 jp->waited = 1;
4070 jp = jp->prev_job; 4070 jp = jp->prev_job;
4071 } 4071 }
4072 blocking_wait_with_raise_on_sig();
4072 /* man bash: 4073 /* man bash:
4073 * "When bash is waiting for an asynchronous command via 4074 * "When bash is waiting for an asynchronous command via
4074 * the wait builtin, the reception of a signal for which a trap 4075 * the wait builtin, the reception of a signal for which a trap
4075 * has been set will cause the wait builtin to return immediately 4076 * has been set will cause the wait builtin to return immediately
4076 * with an exit status greater than 128, immediately after which 4077 * with an exit status greater than 128, immediately after which
4077 * the trap is executed." 4078 * the trap is executed."
4078 * Do we do it that way? */ 4079 *
4079 blocking_wait_with_raise_on_sig(NULL); 4080 * blocking_wait_with_raise_on_sig raises signal handlers
4081 * if it gets no pid (pid < 0). However,
4082 * if child sends us a signal *and immediately exits*,
4083 * blocking_wait_with_raise_on_sig gets pid > 0
4084 * and does not handle pending_sig. Check this case: */
4085 if (pending_sig)
4086 raise_exception(EXSIG);
4080 } 4087 }
4081 } 4088 }
4082 4089
@@ -4096,7 +4103,7 @@ waitcmd(int argc UNUSED_PARAM, char **argv)
4096 job = getjob(*argv, 0); 4103 job = getjob(*argv, 0);
4097 /* loop until process terminated or stopped */ 4104 /* loop until process terminated or stopped */
4098 while (job->state == JOBRUNNING) 4105 while (job->state == JOBRUNNING)
4099 blocking_wait_with_raise_on_sig(NULL); 4106 blocking_wait_with_raise_on_sig();
4100 job->waited = 1; 4107 job->waited = 1;
4101 retval = getstatus(job); 4108 retval = getstatus(job);
4102 repeat: ; 4109 repeat: ;
diff --git a/shell/ash_test/ash-signals/signal5.tests b/shell/ash_test/ash-signals/signal5.tests
index b75b14917..5003180f7 100755
--- a/shell/ash_test/ash-signals/signal5.tests
+++ b/shell/ash_test/ash-signals/signal5.tests
@@ -1,4 +1,3 @@
1# Not fixed yet
2trap "echo USR1 received" USR1 1trap "echo USR1 received" USR1
3stub() { 2stub() {
4 echo "sleeping for $1 sec" 3 echo "sleeping for $1 sec"