From 2556498ee191cc9eaa505c611c5570937ff32315 Mon Sep 17 00:00:00 2001 From: David Teigland Date: Wed, 15 Feb 2017 14:09:45 -0600 Subject: [PATCH] lvcreate: fix LVM_VG_NAME detection Commit d3af0e7528dbba30824379fc98cb4db437559ad5 was not quite right in testing if the env var was set. --- tools/lvmcmdline.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c index 41ae8c4b8..ed32f1cf5 100644 --- a/tools/lvmcmdline.c +++ b/tools/lvmcmdline.c @@ -1280,7 +1280,6 @@ check_val: static int _command_required_pos_matches(struct cmd_context *cmd, int ci, int rp, char **argv) { const char *name; - char *gotenv = NULL; /* * rp is the index in required_pos_args[] of the required positional arg. @@ -1315,9 +1314,9 @@ static int _command_required_pos_matches(struct cmd_context *cmd, int ci, int rp (arg_is_set(cmd, name_ARG) || arg_is_set(cmd, thinpool_ARG) || arg_is_set(cmd, cachepool_ARG) || - (gotenv = getenv("LVM_VG_NAME")))) { + getenv("LVM_VG_NAME"))) { - if (gotenv) + if (getenv("LVM_VG_NAME")) return 1; if ((name = arg_str_value(cmd, name_ARG, NULL))) { -- 2.43.5