summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2011-07-18 18:13:03 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2011-07-18 18:13:03 +0000
commit5c3c825e5fee76829b8f61020c3f0e72f9f6b316 (patch)
treeaa6fd6035c1d0f1ce99761127058d1f331e0ca08
parent5f275faa955024a78771eb6991220ebb03536b47 (diff)
downloadzsh-5c3c825e5fee76829b8f61020c3f0e72f9f6b316.tar.gz
zsh-5c3c825e5fee76829b8f61020c3f0e72f9f6b316.zip
users/16131: skip reading empty history file
-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;