svn commit: r217485 - stable/8/bin/sh

Jilles Tjoelker jilles at FreeBSD.org
Sun Jan 16 22:10:19 UTC 2011


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;
 }
 


More information about the svn-src-stable-8 mailing list