mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-05 13:18:20 +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)
|
static int _command_required_pos_matches(struct cmd_context *cmd, int ci, int rp, char **argv)
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
|
char *gotenv = NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* rp is the index in required_pos_args[] of the required positional arg.
|
* 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") &&
|
if (!strcmp(cmd->name, "lvcreate") &&
|
||||||
(rp == 0) &&
|
(rp == 0) &&
|
||||||
val_bit_is_set(commands[ci].required_pos_args[rp].def.val_bits, vg_VAL) &&
|
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 ((name = arg_str_value(cmd, name_ARG, NULL))) {
|
||||||
if (strstr(name, "/") || getenv("LVM_VG_NAME"))
|
if (strstr(name, "/"))
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: does LVM_VG_NAME also work with --thinpool/--cachepool ? */
|
|
||||||
|
|
||||||
if ((name = arg_str_value(cmd, thinpool_ARG, NULL))) {
|
if ((name = arg_str_value(cmd, thinpool_ARG, NULL))) {
|
||||||
if (strstr(name, "/"))
|
if (strstr(name, "/"))
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user