Source-Changes-HG archive

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

[src/trunk]: src/bin/sh PR bin/47065 PR bin/39466



details:   https://anonhg.NetBSD.org/src/rev/dcd3164c0e63
branches:  trunk
changeset: 345568:dcd3164c0e63
user:      kre <kre%NetBSD.org@localhost>
date:      Wed Jun 01 02:50:02 2016 +0000

description:
PR bin/47065 PR bin/39466

When the shell exits after an error (when that is the right thing for
it to do) ensure that it never does exit(0).

diffstat:

 bin/sh/error.c |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (30 lines):

diff -r bfd987eddda1 -r dcd3164c0e63 bin/sh/error.c
--- a/bin/sh/error.c    Wed Jun 01 02:47:05 2016 +0000
+++ b/bin/sh/error.c    Wed Jun 01 02:50:02 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: error.c,v 1.38 2012/03/15 02:02:20 joerg Exp $ */
+/*     $NetBSD: error.c,v 1.39 2016/06/01 02:50:02 kre Exp $   */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)error.c    8.2 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: error.c,v 1.38 2012/03/15 02:02:20 joerg Exp $");
+__RCSID("$NetBSD: error.c,v 1.39 2016/06/01 02:50:02 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -179,6 +179,11 @@
 {
        va_list ap;
 
+       /*
+        * On error, we certainly never want exit(0)...
+        */
+       if (exerrno == 0)
+               exerrno = 1;
        va_start(ap, msg);
        exverror(EXERROR, msg, ap);
        /* NOTREACHED */



Home | Main Index | Thread Index | Old Index