Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 Jan 2011 22:10:18 +0000 (UTC)
From:      Jilles Tjoelker <jilles@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r217485 - stable/8/bin/sh
Message-ID:  <201101162210.p0GMAIs5078771@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jilles
Date: Sun Jan 16 22:10:18 2011
New Revision: 217485
URL: http://svn.freebsd.org/changeset/base/217485

Log:
  MFC r216806: 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.
  (Note: not tested on stable/8 with clang.)

Modified:
  stable/8/bin/sh/histedit.c
Directory Properties:
  stable/8/bin/sh/   (props changed)

Modified: stable/8/bin/sh/histedit.c
==============================================================================
--- stable/8/bin/sh/histedit.c	Sun Jan 16 21:59:50 2011	(r217484)
+++ stable/8/bin/sh/histedit.c	Sun Jan 16 22:10:18 2011	(r217485)
@@ -214,6 +214,7 @@ histcmd(int argc, char **argv)
 		}
 	argc -= optind, argv += optind;
 
+	savehandler = handler;
 	/*
 	 * If executing...
 	 */
@@ -224,7 +225,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)
@@ -380,6 +380,7 @@ histcmd(int argc, char **argv)
 		--active;
 	if (displayhist)
 		displayhist = 0;
+	handler = savehandler;
 	return 0;
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201101162210.p0GMAIs5078771>