mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-31 05:47:43 +03:00
5649834f7d
We may call arg_count/grouped_arg_count/arg_value soon enough that cmd->arg_values is not set yet. Normally, when running a command, we execute lvm_run_command which in turn calls _process_command_line to allocate and parse the command line values and stores them in cmd->arg_values. However, if we run lvm shell, this one doesn't accept any command line options and we parse the command line for each command that is executed within the lvm shell then. If we used any code that tries to access cmd->arg_values through any of the the arg handling functions too early, we could end up with a segfault due to uninitialized (NULL) cmd->arg_values. This patch just saves extra checks in all the code where arg handling may be called too early so that the cmd->arg_values is not set up yet. This does not apply to any of existing code, but subsequent patches will need that.