Module Name:    src
Committed By:   kre
Date:           Thu Sep 13 22:12:35 UTC 2018

Modified Files:
        src/bin/sh: jobs.c

Log Message:
A change in rev 1.91 interacted badly with the way that showjobs()
worked, preventing $(jobs) (and more usefully $(jobs -p) from
working.   Fix that.

XXX pullup -8


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 src/bin/sh/jobs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/sh/jobs.c
diff -u src/bin/sh/jobs.c:1.100 src/bin/sh/jobs.c:1.101
--- src/bin/sh/jobs.c:1.100	Tue Sep  4 23:16:30 2018
+++ src/bin/sh/jobs.c	Thu Sep 13 22:12:35 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: jobs.c,v 1.100 2018/09/04 23:16:30 kre Exp $	*/
+/*	$NetBSD: jobs.c,v 1.101 2018/09/13 22:12:35 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)jobs.c	8.5 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: jobs.c,v 1.100 2018/09/04 23:16:30 kre Exp $");
+__RCSID("$NetBSD: jobs.c,v 1.101 2018/09/13 22:12:35 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -586,14 +586,13 @@ showjobs(struct output *out, int mode)
 		silent = 1;
 	}
 #endif
-	if (jobs_invalid)
-		return;
 
 	for (jobno = 1, jp = jobtab ; jobno <= njobs ; jobno++, jp++) {
 		if (!jp->used)
 			continue;
 		if (jp->nprocs == 0) {
-			freejob(jp);
+			if (!jobs_invalid)
+				freejob(jp);
 			continue;
 		}
 		if ((mode & SHOW_CHANGED) && !(jp->flags & JOBCHANGED))

Reply via email to