svn commit: trunk/busybox/shell

vda at busybox.net vda at busybox.net
Sun Jul 15 01:13:27 UTC 2007


Author: vda
Date: 2007-07-14 18:13:25 -0700 (Sat, 14 Jul 2007)
New Revision: 19092

Log:
ash: make "jobs | cat" work like in bash (was giving empty output)



Modified:
   trunk/busybox/shell/ash.c


Changeset:
Modified: trunk/busybox/shell/ash.c
===================================================================
--- trunk/busybox/shell/ash.c	2007-07-14 22:51:28 UTC (rev 19091)
+++ trunk/busybox/shell/ash.c	2007-07-15 01:13:25 UTC (rev 19092)
@@ -4374,8 +4374,10 @@
 		}
 	}
 }
-/* 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 @@
 		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)
 {




More information about the busybox-cvs mailing list