1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

lvm: fix reporting path with HOME envvar

When envvar HOME is not present we were using invalid path with (null).
This commit is contained in:
Zdenek Kabelac 2023-10-16 12:57:41 +02:00
parent 7e017abb30
commit 493af2bb16

View File

@ -154,7 +154,7 @@ static int _hist_file(char *buffer, size_t size)
{ {
char *e = getenv("HOME"); char *e = getenv("HOME");
if (dm_snprintf(buffer, size, "%s/.lvm_history", e) < 0) { if (dm_snprintf(buffer, size, "%s%s.lvm_history", e ? :"", e ? "/" : "") < 0) {
log_error("$HOME/.lvm_history: path too long"); log_error("$HOME/.lvm_history: path too long");
return 0; return 0;
} }