summary refs log tree commit diff
path: root/Src/builtin.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/builtin.c')
-rw-r--r--Src/builtin.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/Src/builtin.c b/Src/builtin.c
index 44d85b80a..a9d9b413e 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -4235,16 +4235,18 @@ bin_eval(UNUSED(char *nam), char **argv, UNUSED(Options ops), UNUSED(int func))
      * we use a special script name to indicate the special line number.
      */
     ineval = !isset(EVALLINENO);
+    if (!ineval)
+	scriptname = "(eval)";
 
     prog = parse_string(zjoin(argv, ' ', 1));
     if (!prog) {
 	errflag = 0;
+        scriptname = oscriptname;
+        ineval = oineval;
 	return 1;
     }
 
     lastval = 0;
-    if (!ineval)
-	scriptname = "(eval)";
 
     execode(prog, 1, 0);
 
@@ -4253,8 +4255,7 @@ bin_eval(UNUSED(char *nam), char **argv, UNUSED(Options ops), UNUSED(int func))
 	errflag = 0;
     }
 
-    if (!ineval)
-	scriptname = oscriptname;
+    scriptname = oscriptname;
     ineval = oineval;
 
     return lastval;