mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
commands: fix lvm shell segfaults
Don't check for -h/--help if argc is 1.
This commit is contained in:
parent
56768ce36b
commit
3cd492cd59
@ -1,5 +1,6 @@
|
||||
Version 2.02.173 -
|
||||
=================================
|
||||
Accept 'lvm -h' and 'lvm --help' as well as 'lvm help' for help.
|
||||
Suppress error message from accept() on clean lvmetad shutdown.
|
||||
Tidy clvmd client list processing and fix segfaults.
|
||||
Protect clvmd debug log messages with mutex and add client id.
|
||||
|
@ -3430,17 +3430,19 @@ int lvm2_main(int argc, char **argv)
|
||||
log_sys_error("unsetenv", "LVM_DID_EXEC");
|
||||
}
|
||||
|
||||
/* "version" command is simple enough so it doesn't need any complex init */
|
||||
if (!alias && argc > 1 && !strcmp(argv[1], "version"))
|
||||
return lvm_return_code(version(NULL, argc, argv));
|
||||
if (!alias && argc > 1) {
|
||||
/* "version" command is simple enough so it doesn't need any complex init */
|
||||
if (!strcmp(argv[1], "version"))
|
||||
return lvm_return_code(version(NULL, argc, argv));
|
||||
|
||||
/* turn 'lvm -h' and 'lvm --help' into 'lvm help' */
|
||||
if (!alias && (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")))
|
||||
argv[1] = (char *)"help";
|
||||
/* turn 'lvm -h' and 'lvm --help' into 'lvm help' */
|
||||
if (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help"))
|
||||
argv[1] = (char *)"help";
|
||||
|
||||
if (!alias && (*argv[1] == '-')) {
|
||||
log_error("Specify options after a command: lvm [command] [options].");
|
||||
return -1;
|
||||
if (*argv[1] == '-') {
|
||||
log_error("Specify options after a command: lvm [command] [options].");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(cmd = init_lvm(0, 0)))
|
||||
|
Loading…
Reference in New Issue
Block a user