about summary refs log tree commit diff
path: root/Src/hist.c
diff options
context:
space:
mode:
authorWayne Davison <wayned@users.sourceforge.net>2001-08-07 19:53:19 +0000
committerWayne Davison <wayned@users.sourceforge.net>2001-08-07 19:53:19 +0000
commitf7e8ca1d9673d31cd2d642572c48e6196b8106de (patch)
tree052c2a472c1b3c79e278c892e62e019dcb30ec5c /Src/hist.c
parentadbab91edbb9df8a8c4bc9c98fc68ca857a4fcf6 (diff)
downloadzsh-f7e8ca1d9673d31cd2d642572c48e6196b8106de.tar.gz
zsh-f7e8ca1d9673d31cd2d642572c48e6196b8106de.tar.xz
zsh-f7e8ca1d9673d31cd2d642572c48e6196b8106de.zip
When rewriting the history file, set histactive to 0 and restore it
when we're done.  This prevents the loss of the file's last line
when a signal causes us to rewrite it.  Also restore the value of
histsiz.
Diffstat (limited to 'Src/hist.c')
-rw-r--r--Src/hist.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Src/hist.c b/Src/hist.c
index 842863992..a37b230b0 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -2028,10 +2028,13 @@ savehistfile(char *fn, int err, int writeflags)
 	    Histent remember_hist_ring = hist_ring;
 	    int remember_histlinect = histlinect;
 	    int remember_curhist = curhist;
+	    int remember_histsiz = histsiz;
+	    int remember_histactive = histactive;
 
 	    hist_ring = NULL;
 	    curhist = histlinect = 0;
 	    histsiz = savehist;
+	    histactive = 0;
 	    createhisttable(); /* sets histtab */
 
 	    hist_ignore_all_dups |= isset(HISTSAVENODUPS);
@@ -2044,6 +2047,8 @@ savehistfile(char *fn, int err, int writeflags)
 	    histlinect = remember_histlinect;
 	    hist_ring = remember_hist_ring;
 	    histtab = remember_histtab;
+	    histsiz = remember_histsiz;
+	    histactive = remember_histactive;
 	}
     } else if (err)
 	zerr("can't write history file %s", fn, 0);