From f31e8d08cdd9d8053e0c8e2a59b021de94758da6 Mon Sep 17 00:00:00 2001 From: Dave Wysochanski Date: Thu, 11 Dec 2008 03:36:16 +0000 Subject: [PATCH] Move initialization of cmd->fmt into init_formats(). init_formats() sets up the command formats, and currently sets cmd->fmt_backup but does not set cmd->fmt to a default value. This seems incorrect so we set it to cmd->default_settings.fmt before returning. The call we remove here may set cmd->fmt based on a command line setting. But it is safe to remove this, because the only caller of init_lvm() that cares about the cmdline override is the cmdline tools (clvmd does not care), called from lvm2_main(). After lvm2_main() calls init_lvm(), it later calls lvm_run_command(). In lvm_run_command(), we have a call to _apply_settings(), which has the identical assignment of cmd->fmt that this patch removes. --- lib/commands/toolcontext.c | 1 + tools/lvmcmdline.c | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c index 186a81601..e9ef66c2c 100644 --- a/lib/commands/toolcontext.c +++ b/lib/commands/toolcontext.c @@ -784,6 +784,7 @@ static int _init_formats(struct cmd_context *cmd) if (!strcasecmp(fmt->name, format) || (fmt->alias && !strcasecmp(fmt->alias, format))) { cmd->default_settings.fmt = fmt; + cmd->fmt = cmd->default_settings.fmt; return 1; } } diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c index de98940d1..66a20ad5f 100644 --- a/tools/lvmcmdline.c +++ b/tools/lvmcmdline.c @@ -1094,9 +1094,6 @@ struct cmd_context *init_lvm(unsigned is_static) init_full_scan_done(0); init_mirror_in_sync(0); - cmd->fmt = arg_ptr_value(cmd, metadatatype_ARG, - cmd->current_settings.fmt); - return cmd; } -- 2.43.5