summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--src/eval.c4
2 files changed, 6 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 768374a..70bce7e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,10 @@
 	* Optimize dash -c "command" to avoid a fork.
 	* Eliminate unnecessary promotion in echocmd.
 
+2011-05-25  Jim Meyering  <meyering@redhat.com>
+
+	* Avoid using undefined handler.
+
 2011-05-23  Jim Meyering  <meyering@redhat.com>
 
 	* Avoid gcc warning: variable 'oldstackp' set but not used.
diff --git a/src/eval.c b/src/eval.c
index 6e7b932..95d30f4 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -897,9 +897,9 @@ evalbltin(const struct builtincmd *cmd, int argc, char **argv, int flags)
 	int i;
 
 	savecmdname = commandname;
+	savehandler = handler;
 	if ((i = setjmp(jmploc.loc)))
 		goto cmddone;
-	savehandler = handler;
 	handler = &jmploc;
 	commandname = argv[0];
 	argptr = argv + 1;
@@ -930,11 +930,11 @@ evalfun(struct funcnode *func, int argc, char **argv, int flags)
 
 	saveparam = shellparam;
 	savefuncline = funcline;
+	savehandler = handler;
 	if ((e = setjmp(jmploc.loc))) {
 		goto funcdone;
 	}
 	INTOFF;
-	savehandler = handler;
 	handler = &jmploc;
 	shellparam.malloc = 0;
 	func->count++;