Source-Changes-HG archive

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

[src/trunk]: src/bin/sh PR/46327: David Mandelberg: Fix exit codes of backgro...



details:   https://anonhg.NetBSD.org/src/rev/ca656666c1ac
branches:  trunk
changeset: 813885:ca656666c1ac
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Feb 24 14:57:12 2016 +0000

description:
PR/46327: David Mandelberg: Fix exit codes of background jobs (from kre)

diffstat:

 bin/sh/eval.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r 91a2b8ae87cf -r ca656666c1ac bin/sh/eval.c
--- a/bin/sh/eval.c     Wed Feb 24 14:51:20 2016 +0000
+++ b/bin/sh/eval.c     Wed Feb 24 14:57:12 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: eval.c,v 1.112 2016/02/22 20:03:48 christos Exp $      */
+/*     $NetBSD: eval.c,v 1.113 2016/02/24 14:57:12 christos Exp $      */
 
 /*-
  * Copyright (c) 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)eval.c     8.9 (Berkeley) 6/8/95";
 #else
-__RCSID("$NetBSD: eval.c,v 1.112 2016/02/22 20:03:48 christos Exp $");
+__RCSID("$NetBSD: eval.c,v 1.113 2016/02/24 14:57:12 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -462,8 +462,7 @@
                /* never returns */
                evaltree(n->nredir.n, flags | EV_EXIT);
        }
-       if (! backgnd)
-               exitstatus = waitforjob(jp);
+       exitstatus = backgnd ? 0 : waitforjob(jp);
        INTON;
 }
 
@@ -1084,6 +1083,7 @@
        goto out;
 
 parent:        /* parent process gets here (if we forked) */
+       exitstatus = 0;         /* if not altered just below */
        if (mode == FORK_FG) {  /* argument to fork */
                exitstatus = waitforjob(jp);
        } else if (mode == FORK_NOJOB) {



Home | Main Index | Thread Index | Old Index