Module Name:    src
Committed By:   martin
Date:           Sun Dec  7 15:58:27 UTC 2014

Modified Files:
        src/bin/sh [netbsd-6]: jobs.c

Log Message:
Pullup the following revisions, requested by spz in #1205:
src/bin/sh/jobs.c       1.73

PR/48729: Torbj�rn Granlund: Avoid negative index in array ref.


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.69.4.1 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.69 src/bin/sh/jobs.c:1.69.4.1
--- src/bin/sh/jobs.c:1.69	Sat Jun 18 21:18:46 2011
+++ src/bin/sh/jobs.c	Sun Dec  7 15:58:27 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: jobs.c,v 1.69 2011/06/18 21:18:46 christos Exp $	*/
+/*	$NetBSD: jobs.c,v 1.69.4.1 2014/12/07 15:58:27 martin 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.69 2011/06/18 21:18:46 christos Exp $");
+__RCSID("$NetBSD: jobs.c,v 1.69.4.1 2014/12/07 15:58:27 martin Exp $");
 #endif
 #endif /* not lint */
 
@@ -636,7 +636,7 @@ waitcmd(int argc, char **argv)
 			if (dowait(WBLOCK|WNOFREE, job) == -1)
 			       return 128 + SIGINT;
 		}
-		status = job->ps[job->nprocs - 1].status;
+		status = job->ps[job->nprocs ? job->nprocs - 1 : 0].status;
 		if (WIFEXITED(status))
 			retval = WEXITSTATUS(status);
 #if JOBS

Reply via email to