about summary refs log tree commit diff
path: root/Src/hist.c
diff options
context:
space:
mode:
authorBarton E. Schaefer <schaefer@zsh.org>2016-12-30 22:35:29 -0800
committerBarton E. Schaefer <schaefer@zsh.org>2017-01-03 14:43:32 -0800
commitd0f7a3b2d6abe48b705dbcde1c601e5224478bee (patch)
tree163dd0de25a8e914b5c0ef7798b407b62e279763 /Src/hist.c
parente90a512aa600580e25617d3a7763c5f0cd5bccd2 (diff)
downloadzsh-d0f7a3b2d6abe48b705dbcde1c601e5224478bee.tar.gz
zsh-d0f7a3b2d6abe48b705dbcde1c601e5224478bee.tar.xz
zsh-d0f7a3b2d6abe48b705dbcde1c601e5224478bee.zip
40248: suppress errors from zshaddhistoryhook
and do not call it if no history entry will be written
Diffstat (limited to 'Src/hist.c')
-rw-r--r--Src/hist.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Src/hist.c b/Src/hist.c
index 97fd34039..350688d2d 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -1418,7 +1418,7 @@ hend(Eprog prog)
 	DPUTS(hptr < chline, "History end pointer off start of line");
 	*hptr = '\0';
     }
-    {
+    if (*chline) {
 	LinkList hookargs = newlinklist();
 	int save_errflag = errflag;
 	errflag = 0;
@@ -1427,6 +1427,7 @@ hend(Eprog prog)
 	addlinknode(hookargs, chline);
 	callhookfunc("zshaddhistory", hookargs, 1, &hookret);
 
+	errflag &= ~ERRFLAG_ERROR;
 	errflag |= save_errflag;
     }
     /* For history sharing, lock history file once for both read and write */