1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-17 12:41:14 +02:00

34118: Don't crash when writing out history if HOST is unset

Found by Coverity (Issue 1255793).
This commit is contained in:
Mikael Magnusson 2015-01-06 01:01:08 +01:00
parent a150563fb0
commit 6b79f29fb2
2 changed files with 5 additions and 1 deletions

View file

@ -1,5 +1,8 @@
2015-01-06 Mikael Magnusson <mikachu@gmail.com>
* 34118: Src/hist.c: Don't crash when writing out history if
HOST is unset
* 34114: Src/builtin.c: emulate: Handle aborting from mixed
-L/-c correctly

View file

@ -2801,7 +2801,8 @@ lockhistfile(char *fn, int keep_trying)
#ifdef HAVE_LINK
# ifdef HAVE_SYMLINK
sprintf(pidbuf, "/pid-%ld/host-", (long)mypid);
lnk = bicat(pidbuf, getsparam("HOST"));
lnk = getsparam("HOST");
lnk = bicat(pidbuf, lnk ? lnk : "");
/* We'll abuse fd as our success flag. */
while ((fd = symlink(lnk, lockfile)) < 0) {
if (errno != EEXIST) {