Module Name:    src
Committed By:   kre
Date:           Wed Jun  1 02:50:03 UTC 2016

Modified Files:
        src/bin/sh: error.c

Log Message:
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).


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/bin/sh/error.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/error.c
diff -u src/bin/sh/error.c:1.38 src/bin/sh/error.c:1.39
--- src/bin/sh/error.c:1.38	Thu Mar 15 02:02:20 2012
+++ src/bin/sh/error.c	Wed Jun  1 02:50:02 2016
@@ -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 @@ error(const char *msg, ...)
 {
 	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 */

Reply via email to