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/36532 (perhaps)
details: https://anonhg.NetBSD.org/src/rev/3a6e58ff1ff5
branches: trunk
changeset: 320827:3a6e58ff1ff5
user: kre <kre%NetBSD.org@localhost>
date: Sun Jul 22 20:43:58 2018 +0000
description:
PR bin/36532 (perhaps)
This is more or less the same patch as provided in the PR
(just 11 years later, so changed a bit) by woods@...
Since there is no known way to actually cause the reported crash,
we may never know if this change actually fixes anything. But
even if it doesn't it certainly cannot hurt.
There is a potential race which could possibly explain the issue
(see commentary in the PR) which is not easy to avoid - if that is
the actual cause, this should provide a defence, if not really a fix.
diffstat:
bin/sh/trap.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diffs (33 lines):
diff -r bf662aa95d2f -r 3a6e58ff1ff5 bin/sh/trap.c
--- a/bin/sh/trap.c Sun Jul 22 20:42:50 2018 +0000
+++ b/bin/sh/trap.c Sun Jul 22 20:43:58 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.43 2018/07/22 20:42:50 kre Exp $ */
+/* $NetBSD: trap.c,v 1.44 2018/07/22 20:43:58 kre Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)trap.c 8.5 (Berkeley) 6/5/95";
#else
-__RCSID("$NetBSD: trap.c,v 1.43 2018/07/22 20:42:50 kre Exp $");
+__RCSID("$NetBSD: trap.c,v 1.44 2018/07/22 20:43:58 kre Exp $");
#endif
#endif /* not lint */
@@ -523,9 +523,11 @@
savestatus=exitstatus;
CTRACE(DBG_TRAP|DBG_SIG, ("dotrap %d: \"%s\"\n", i,
trap[i] ? trap[i] : "-NULL-"));
- tr = savestr(trap[i]); /* trap code may free trap[i] */
- evalstring(tr, 0);
- ckfree(tr);
+ if ((tr = trap[i]) != NULL) {
+ tr = savestr(tr); /* trap code may free trap[i] */
+ evalstring(tr, 0);
+ ckfree(tr);
+ }
exitstatus=savestatus;
}
}
Home |
Main Index |
Thread Index |
Old Index