mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
lvcreate: LVM_VG_NAME applies even without name arg
There was a small flaw in the logic regarding when LVM_VG_NAME can replace a VG position arg.
This commit is contained in:
parent
7417c8acfa
commit
d3af0e7528
@ -1280,6 +1280,7 @@ 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.
|
||||
@ -1311,14 +1312,19 @@ static int _command_required_pos_matches(struct cmd_context *cmd, int ci, int rp
|
||||
if (!strcmp(cmd->name, "lvcreate") &&
|
||||
(rp == 0) &&
|
||||
val_bit_is_set(commands[ci].required_pos_args[rp].def.val_bits, vg_VAL) &&
|
||||
(arg_is_set(cmd, name_ARG) || arg_is_set(cmd, thinpool_ARG) || arg_is_set(cmd, cachepool_ARG))) {
|
||||
(arg_is_set(cmd, name_ARG) ||
|
||||
arg_is_set(cmd, thinpool_ARG) ||
|
||||
arg_is_set(cmd, cachepool_ARG) ||
|
||||
(gotenv = getenv("LVM_VG_NAME")))) {
|
||||
|
||||
if (gotenv)
|
||||
return 1;
|
||||
|
||||
if ((name = arg_str_value(cmd, name_ARG, NULL))) {
|
||||
if (strstr(name, "/") || getenv("LVM_VG_NAME"))
|
||||
if (strstr(name, "/"))
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* FIXME: does LVM_VG_NAME also work with --thinpool/--cachepool ? */
|
||||
|
||||
if ((name = arg_str_value(cmd, thinpool_ARG, NULL))) {
|
||||
if (strstr(name, "/"))
|
||||
return 1;
|
||||
|
Loading…
Reference in New Issue
Block a user