From 6f195241f3ee98c11bc93ab089417012767d9cec Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Mon, 7 Oct 2013 13:01:26 +0100 Subject: 31794: further refinement to INCAPPENDHISTORY change. With SHAREHISTORY we should make sure the code behaves as it always did, because it takes care about locking a file once for reading and writing. --- Src/hist.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'Src/hist.c') diff --git a/Src/hist.c b/Src/hist.c index c58ce8b34..d1af30a29 100644 --- a/Src/hist.c +++ b/Src/hist.c @@ -928,7 +928,15 @@ hbegin(int dohist) histactive = HA_ACTIVE | HA_NOINC; hf = getsparam("HISTFILE"); - if (isset(INCAPPENDHISTORY) && !(histactive & HA_NOINC) && !strin) + /* + * For INCAPPENDHISTORY, when interactive, save the history here + * as it gives a better estimate of the times of commands. + * If SHAREHISTORY is also set continue to do so in the + * standard place, because that's safer about reading and + * rewriting history atomically. + */ + if (isset(INCAPPENDHISTORY) && !isset(SHAREHISTORY) && + !(histactive & HA_NOINC) && !strin) savehistfile(hf, 0, HFILE_USE_OPTIONS | HFILE_FAST); } -- cgit 1.4.1