aboutsummaryrefslogtreecommitdiff
path: root/shell/ash.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-07-15 01:13:25 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-07-15 01:13:25 +0000
commitbdc406d15d5efa45970ebaf404f0d2a411abff91 (patch)
tree09b12bfa7057850b8e49dde7a87d804d74484e41 /shell/ash.c
parent39125bec38ac3a13ae550ee7ba3e924a42a73e18 (diff)
downloadbusybox-bdc406d15d5efa45970ebaf404f0d2a411abff91.tar.gz
ash: make "jobs | cat" work like in bash (was giving empty output)
Diffstat (limited to 'shell/ash.c')
-rw-r--r--shell/ash.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 6173a2505..06c4698f9 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -4374,8 +4374,10 @@ clear_traps(void)
}
}
}
-/* lives far away from here, needed for forkchild */
+
+/* Lives far away from here, needed for forkchild */
static void closescript(void);
+/* Called after fork(), in child */
static void
forkchild(struct job *jp, union node *n, int mode)
{
@@ -4419,11 +4421,18 @@ forkchild(struct job *jp, union node *n, int mode)
setsignal(SIGQUIT);
setsignal(SIGTERM);
}
+#if JOBS
+ /* For "jobs | cat" to work like in bash, we must retain list of jobs
+ * in child, but we do need to remove ourself */
+ freejob(jp);
+#else
for (jp = curjob; jp; jp = jp->prev_job)
freejob(jp);
+#endif
jobless = 0;
}
+/* Called after fork(), in parent */
static void
forkparent(struct job *jp, union node *n, int mode, pid_t pid)
{