master - commands: fix commands with run with path basename
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=0dabe7237c531459792de953879a5c4c6de41c65 Commit: 0dabe7237c531459792de953879a5c4c6de41c65 Parent: e8362b4cb7fcb4575d843f5b1f6e5c8b66fa99c0 Author: David Teigland <[email protected]> AuthorDate: Thu Mar 23 03:06:07 2017 -0500 Committer: David Teigland <[email protected]> CommitterDate: Thu Mar 23 03:06:07 2017 -0500
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.
--- tools/lvmcmdline.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
tools/lvmcmdline.c +2 -2
@@ -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 ];