From 685a270543d9271755399270bd801b5e32fd680b Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Wed, 29 Dec 2010 19:39:51 +0000 Subject: [PATCH] sh: Properly restore exception handler in fc. If SIGINT arrived at exactly the right moment (unlikely), an exception handler in a no longer active stack frame would be called. Because the old handler was not used in the normal path, clang thought it was a dead value and if an exception happened it would longjmp() to garbage. This caused builtins/fc1.0 to fail if histedit.c was compiled with clang. MFC after: 1 week --- bin/sh/histedit.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/sh/histedit.c b/bin/sh/histedit.c index 26d46a8aef9d..7ebe5d87502a 100644 --- a/bin/sh/histedit.c +++ b/bin/sh/histedit.c @@ -232,6 +232,7 @@ histcmd(int argc, char **argv) } argc -= optind, argv += optind; + savehandler = handler; /* * If executing... */ @@ -242,7 +243,6 @@ histcmd(int argc, char **argv) * Catch interrupts to reset active counter and * cleanup temp files. */ - savehandler = handler; if (setjmp(jmploc.loc)) { active = 0; if (editfile) @@ -399,6 +399,7 @@ histcmd(int argc, char **argv) --active; if (displayhist) displayhist = 0; + handler = savehandler; return 0; }