Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/bin/sh PR/48729: Torbj?rn Granlund: Avoid negative index in ...



details:   https://anonhg.NetBSD.org/src/rev/f67fd805b32e
branches:  trunk
changeset: 795392:f67fd805b32e
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Apr 11 01:49:45 2014 +0000

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

diffstat:

 bin/sh/jobs.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 6d8fb10d552e -r f67fd805b32e bin/sh/jobs.c
--- a/bin/sh/jobs.c     Fri Apr 11 01:03:08 2014 +0000
+++ b/bin/sh/jobs.c     Fri Apr 11 01:49:45 2014 +0000
@@ -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 @@
                        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



Home | Main Index | Thread Index | Old Index