diff options
| author | Peter Stephenson <pws@users.sourceforge.net> | 2007-06-23 18:15:14 +0000 |
|---|---|---|
| committer | Peter Stephenson <pws@users.sourceforge.net> | 2007-06-23 18:15:14 +0000 |
| commit | 9534c89981eaa8205c44e6c3b56d6d57bb66f569 (patch) | |
| tree | 6dd2dbd69a83b6dc6abe83e262de86aa45a95fcd /Src/hist.c | |
| parent | 23581: handle errors writing history file better (diff) | |
| download | zsh-9534c89981eaa8205c44e6c3b56d6d57bb66f569.tar zsh-9534c89981eaa8205c44e6c3b56d6d57bb66f569.tar.gz zsh-9534c89981eaa8205c44e6c3b56d6d57bb66f569.tar.bz2 zsh-9534c89981eaa8205c44e6c3b56d6d57bb66f569.tar.lz zsh-9534c89981eaa8205c44e6c3b56d6d57bb66f569.tar.xz zsh-9534c89981eaa8205c44e6c3b56d6d57bb66f569.tar.zst zsh-9534c89981eaa8205c44e6c3b56d6d57bb66f569.zip | |
23585: handle errno properly in history save errors
Diffstat (limited to 'Src/hist.c')
| -rw-r--r-- | Src/hist.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Src/hist.c b/Src/hist.c index a02163ff7..6ddfaf506 100644 --- a/Src/hist.c +++ b/Src/hist.c @@ -2190,6 +2190,7 @@ savehistfile(char *fn, int err, int writeflags) if (isset(SHAREHISTORY)) extended_history = 1; } + errno = 0; if (writeflags & HFILE_APPEND) { tmpfile = NULL; out = fdopen(open(unmeta(fn), @@ -2302,10 +2303,10 @@ savehistfile(char *fn, int err, int writeflags) if (ret < 0 && err) { if (tmpfile) { - zerr("failed to write history file %s.new: %e", fn); + zerr("failed to write history file %s.new: %e", fn, errno); free(tmpfile); } else - zerr("failed to write history file %s: %e", fn); + zerr("failed to write history file %s: %e", fn, errno); } unlockhistfile(fn); |
