diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2011-07-18 18:13:03 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2011-07-18 18:13:03 +0000 |
commit | 5c3c825e5fee76829b8f61020c3f0e72f9f6b316 (patch) | |
tree | aa6fd6035c1d0f1ce99761127058d1f331e0ca08 /Src | |
parent | 5f275faa955024a78771eb6991220ebb03536b47 (diff) | |
download | zsh-5c3c825e5fee76829b8f61020c3f0e72f9f6b316.tar.gz zsh-5c3c825e5fee76829b8f61020c3f0e72f9f6b316.tar.xz zsh-5c3c825e5fee76829b8f61020c3f0e72f9f6b316.zip |
users/16131: skip reading empty history file
Diffstat (limited to 'Src')
-rw-r--r-- | Src/hist.c | 8 |
1 files changed, 5 insertions, 3 deletions
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; |