about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorMikael Magnusson <mikachu@gmail.com>2015-01-06 01:01:08 +0100
committerMikael Magnusson <mikachu@gmail.com>2015-01-06 23:45:26 +0100
commit6b79f29fb230e839c97682f9c8648cac2762669e (patch)
tree8b4fed3e376d8bec67cf691f5e2b580b11adb0b5 /Src
parenta150563fb049b338983156a5be4ff760a0d79c20 (diff)
downloadzsh-6b79f29fb230e839c97682f9c8648cac2762669e.tar.gz
zsh-6b79f29fb230e839c97682f9c8648cac2762669e.tar.xz
zsh-6b79f29fb230e839c97682f9c8648cac2762669e.zip
34118: Don't crash when writing out history if HOST is unset
Found by Coverity (Issue 1255793).
Diffstat (limited to 'Src')
-rw-r--r--Src/hist.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Src/hist.c b/Src/hist.c
index a0061707c..8ff9eff82 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -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) {