summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2000-08-30 01:46:35 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2000-08-30 01:46:35 +0000
commit4e98534bb61d55bf727abab827804413816e10f2 (patch)
treedacc4d80795e9129a941653c7c0d31f7ffb39897
parent28da9623e1de63ef51e014e75d1ec3eb77f7fc6c (diff)
prevent core dumps when stderror() is called before reslab is initialized
-rw-r--r--bin/csh/csh.c5
-rw-r--r--bin/csh/csh.h3
-rw-r--r--bin/csh/error.c6
3 files changed, 8 insertions, 6 deletions
diff --git a/bin/csh/csh.c b/bin/csh/csh.c
index 8d5046461f7..5651cfe873c 100644
--- a/bin/csh/csh.c
+++ b/bin/csh/csh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: csh.c,v 1.10 1999/02/21 08:28:00 deraadt Exp $ */
+/* $OpenBSD: csh.c,v 1.11 2000/08/30 01:46:34 mickey Exp $ */
/* $NetBSD: csh.c,v 1.14 1995/04/29 23:21:28 mycroft Exp $ */
/*-
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)csh.c 8.2 (Berkeley) 10/12/93";
#else
-static char rcsid[] = "$OpenBSD: csh.c,v 1.10 1999/02/21 08:28:00 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: csh.c,v 1.11 2000/08/30 01:46:34 mickey Exp $";
#endif
#endif /* not lint */
@@ -522,6 +522,7 @@ notty:
* start-up scripts.
*/
reenter = setexit(); /* PWP */
+ exitset++;
haderr = 0; /* In case second time through */
if (!fast && reenter == 0) {
/* Will have value(STRhome) here because set fast if don't */
diff --git a/bin/csh/csh.h b/bin/csh/csh.h
index 28df6672c6f..eca754f2a10 100644
--- a/bin/csh/csh.h
+++ b/bin/csh/csh.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: csh.h,v 1.5 1999/08/06 20:41:04 deraadt Exp $ */
+/* $OpenBSD: csh.h,v 1.6 2000/08/30 01:46:34 mickey Exp $ */
/* $NetBSD: csh.h,v 1.9 1995/03/21 09:02:40 cgd Exp $ */
/*-
@@ -185,6 +185,7 @@ int OLDSTD; /* Old standard input (def for cmds) */
#include <setjmp.h>
jmp_buf reslab;
+int exitset;
#define setexit() (setjmp(reslab))
#define reset() longjmp(reslab, 1)
diff --git a/bin/csh/error.c b/bin/csh/error.c
index a6edb98a91a..982de021feb 100644
--- a/bin/csh/error.c
+++ b/bin/csh/error.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: error.c,v 1.2 1997/11/15 21:51:28 todd Exp $ */
+/* $OpenBSD: error.c,v 1.3 2000/08/30 01:46:34 mickey Exp $ */
/* $NetBSD: err.c,v 1.6 1995/03/21 09:02:47 cgd Exp $ */
/*-
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)err.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$OpenBSD: error.c,v 1.2 1997/11/15 21:51:28 todd Exp $";
+static char rcsid[] = "$OpenBSD: error.c,v 1.3 2000/08/30 01:46:34 mickey Exp $";
#endif
#endif /* not lint */
@@ -398,7 +398,7 @@ stderror(id, va_alist)
/*
* Go away if -e or we are a child shell
*/
- if (exiterr || child)
+ if (!exitset || exiterr || child)
xexit(1);
/*