summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--Src/hist.c8
2 files changed, 10 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 84e45bb23..ccf74e02d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2011-07-18  Peter Stephenson  <p.w.stephenson@ntlworld.com>
+
+	* users/16131: Src/hist.c: skip reading an empty history file.
+
 2011-07-18  Peter Stephenson  <pws@csr.com>
 
 	* Matthieu Baerts: 29547: Completion/Unix/Command/_bzr: cdiff
@@ -15111,5 +15115,5 @@
 
 *****************************************************
 * This is used by the shell to define $ZSH_PATCHLEVEL
-* $Revision: 1.5396 $
+* $Revision: 1.5397 $
 *****************************************************
diff --git a/Src/hist.c b/Src/hist.c
index f1bae14f4..6edd7b8cd 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -2246,10 +2246,12 @@ readhistfile(char *fn, int err, int readflags)
 
     if (!fn && !(fn = getsparam("HISTFILE")))
 	return;
+    if (stat(unmeta(fn), &sb) < 0 ||
+	sb.st_size == 0)
+	return;
     if (readflags & HFILE_FAST) {
-	if (stat(unmeta(fn), &sb) < 0
-	 || (lasthist.fsiz == sb.st_size && lasthist.mtim == sb.st_mtime)
-	 || lockhistfile(fn, 0))
+	if ((lasthist.fsiz == sb.st_size && lasthist.mtim == sb.st_mtime)
+	    || lockhistfile(fn, 0))
 	    return;
 	lasthist.fsiz = sb.st_size;
 	lasthist.mtim = sb.st_mtime;