1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

commands: fix commands with run with path basename

The recent command definitions commit took the command
name from argv[0] without applying basename to the value,
so a pathname, e.g. /usr/sbin, would cause lvm to not
recognize the command name.
This commit is contained in:
David Teigland 2017-03-23 03:06:07 -05:00
parent e8362b4cb7
commit 0dabe7237c

View File

@ -2632,7 +2632,7 @@ int lvm_run_command(struct cmd_context *cmd, int argc, char **argv)
/* each command should start out with sigint flag cleared */
sigint_clear();
cmd->name = dm_pool_strdup(cmd->mem, argv[0]);
cmd->name = dm_pool_strdup(cmd->mem, dm_basename(argv[0]));
configure_command_option_values(cmd->name);
@ -3356,7 +3356,7 @@ int lvm2_main(int argc, char **argv)
if (!alias && argc == 1)
name = NULL;
else if (alias)
name = argv[0];
name = (char *)dm_basename(argv[0]);
else
name = argv[1];