summary refs log tree commit diff
path: root/Src/hist.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/hist.c')
-rw-r--r--Src/hist.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/Src/hist.c b/Src/hist.c
index 007366a49..7f9e4dbbb 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -1378,7 +1378,6 @@ should_ignore_line(Eprog prog)
 mod_export int
 hend(Eprog prog)
 {
-    LinkList hookargs = newlinklist();
     int flag, hookret, stack_pos = histsave_stack_pos;
     /*
      * save:
@@ -1418,9 +1417,17 @@ hend(Eprog prog)
 	DPUTS(hptr < chline, "History end pointer off start of line");
 	*hptr = '\0';
     }
-    addlinknode(hookargs, "zshaddhistory");
-    addlinknode(hookargs, chline);
-    callhookfunc("zshaddhistory", hookargs, 1, &hookret);
+    {
+	LinkList hookargs = newlinklist();
+	int save_errflag = errflag;
+	errflag = 0;
+
+	addlinknode(hookargs, "zshaddhistory");
+	addlinknode(hookargs, chline);
+	callhookfunc("zshaddhistory", hookargs, 1, &hookret);
+
+	errflag |= save_errflag;
+    }
     /* For history sharing, lock history file once for both read and write */
     hf = getsparam("HISTFILE");
     if (isset(SHAREHISTORY) && !lockhistfile(hf, 0)) {