Module Name: src
Committed By: christos
Date: Fri Apr 11 01:49:45 UTC 2014
Modified Files:
src/bin/sh: jobs.c
Log Message:
PR/48729: Torbj�rn Granlund: Avoid negative index in array ref.
To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 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.72 src/bin/sh/jobs.c:1.73
--- src/bin/sh/jobs.c:1.72 Sun Jan 26 17:38:20 2014
+++ src/bin/sh/jobs.c Thu Apr 10 21:49:45 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: jobs.c,v 1.72 2014/01/26 22:38:20 christos Exp $ */
+/* $NetBSD: jobs.c,v 1.73 2014/04/11 01:49:45 christos 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.72 2014/01/26 22:38:20 christos Exp $");
+__RCSID("$NetBSD: jobs.c,v 1.73 2014/04/11 01:49:45 christos Exp $");
#endif
#endif /* not lint */
@@ -649,7 +649,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