diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | Src/hist.c | 13 |
2 files changed, 12 insertions, 5 deletions
@@ -1,3 +1,7 @@ +2025-04-15 Bart Schaefer <schaefer@zsh.org> + + * 53454: Src/hist.c: fix interrupt handling in savehistfile() + 2025-04-15 Eric Cook <illua@users.sourceforge.net> * 53485: NEWS: update for version 5.10 diff --git a/Src/hist.c b/Src/hist.c index fa1ede3f0..00bdbb2b8 100644 --- a/Src/hist.c +++ b/Src/hist.c @@ -2838,11 +2838,12 @@ readhistfile(char *fn, int err, int readflags) */ if (uselex || remeta) freeheap(); - if (errflag & ERRFLAG_INT) { - /* Can't assume fast read next time if interrupted. */ - lasthist.interrupted = 1; + if (errflag & ERRFLAG_INT) break; - } + } + if (errflag & ERRFLAG_INT) { + /* Can't assume fast read next time if interrupted. */ + lasthist.interrupted = 1; } if (start && readflags & HFILE_USE_OPTIONS) { zsfree(lasthist.text); @@ -3108,7 +3109,9 @@ savehistfile(char *fn, int err, int writeflags) hist_ignore_all_dups |= isset(HISTSAVENODUPS); readhistfile(fn, err, 0); hist_ignore_all_dups = isset(HISTIGNOREALLDUPS); - if (histlinect) + if (errflag & ERRFLAG_INT) + ret = -1; + else if (histlinect) savehistfile(fn, err, 0); pophiststack(); |