From 493af2bb16631a047a045546dbf8ec098900f912 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Mon, 16 Oct 2023 12:57:41 +0200 Subject: [PATCH] lvm: fix reporting path with HOME envvar When envvar HOME is not present we were using invalid path with (null). --- tools/lvm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/lvm.c b/tools/lvm.c index 370dc49e3..1d001dbe9 100644 --- a/tools/lvm.c +++ b/tools/lvm.c @@ -154,7 +154,7 @@ static int _hist_file(char *buffer, size_t size) { 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"); return 0; }