diff options
author | Denys Vlasenko | 2009-07-24 00:16:59 +0200 |
---|---|---|
committer | Denys Vlasenko | 2009-07-24 00:16:59 +0200 |
commit | e56f22ac6072a6279782951fe7aaf633d4d6052a (patch) | |
tree | ec84507384a3eb5489b5de2ec82714a42d7f2f4e | |
parent | 86e83ec4872ee1d3156a5c019fde301497819ca3 (diff) | |
download | busybox-e56f22ac6072a6279782951fe7aaf633d4d6052a.zip busybox-e56f22ac6072a6279782951fe7aaf633d4d6052a.tar.gz |
ash: make "jobs" work even in subshells
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | shell/ash.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/shell/ash.c b/shell/ash.c index 3042516..613a66d 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -4541,8 +4541,11 @@ clear_traps(void) static void closescript(void); /* Called after fork(), in child */ +#if !JOBS +# define forkchild(jp, n, mode) forkchild(jp, mode) +#endif static void -forkchild(struct job *jp, /*union node *n,*/ int mode) +forkchild(struct job *jp, union node *n, int mode) { int oldlvl; @@ -4598,6 +4601,13 @@ forkchild(struct job *jp, /*union node *n,*/ int mode) * Take care of the second rule: */ setsignal(SIGQUIT); } +#if JOBS + if (n && n->type == NCMD && strcmp(n->ncmd.args->narg.text, "jobs") == 0) { + TRACE(("Job hack\n")); + freejob(curjob); + return; + } +#endif for (jp = curjob; jp; jp = jp->prev_job) freejob(jp); jobless = 0; @@ -4659,7 +4669,7 @@ forkshell(struct job *jp, union node *n, int mode) ash_msg_and_raise_error("can't fork"); } if (pid == 0) - forkchild(jp, /*n,*/ mode); + forkchild(jp, n, mode); else forkparent(jp, n, mode, pid); return pid; |