1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

Fix incorrect return value in help function.

This commit is contained in:
Peter Rajnoha 2008-12-19 14:43:02 +00:00
parent 3ad47d16ab
commit ed96a9feb4
2 changed files with 12 additions and 5 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.44 - Version 2.02.44 -
==================================== ====================================
Fix incorrect return value in help function.
Fix vgrename using UUID in case there are VGs with the same name. Fix vgrename using UUID in case there are VGs with the same name.
Fix segfault when invalid field given in reporting commands. Fix segfault when invalid field given in reporting commands.
Refactor init_lvm() for lvmcmdline and clvmd. Refactor init_lvm() for lvmcmdline and clvmd.

View File

@ -568,14 +568,17 @@ static void _short_usage(const char *name)
log_error("Run `%s --help' for more information.", name); log_error("Run `%s --help' for more information.", name);
} }
static void _usage(const char *name) static int _usage(const char *name)
{ {
struct command *com = _find_command(name); struct command *com = _find_command(name);
if (!com) if (!com) {
return; log_print("%s: no such command.", name);
return 0;
}
log_print("%s: %s\n\n%s", com->name, com->desc, com->usage); log_print("%s: %s\n\n%s", com->name, com->desc, com->usage);
return 1;
} }
/* /*
@ -852,15 +855,18 @@ static void _display_help(void)
int help(struct cmd_context *cmd __attribute((unused)), int argc, char **argv) int help(struct cmd_context *cmd __attribute((unused)), int argc, char **argv)
{ {
int ret = ECMD_PROCESSED;
if (!argc) if (!argc)
_display_help(); _display_help();
else { else {
int i; int i;
for (i = 0; i < argc; i++) for (i = 0; i < argc; i++)
_usage(argv[i]); if (!_usage(argv[i]))
ret = EINVALID_CMD_LINE;
} }
return 0; return ret;
} }
static int _override_settings(struct cmd_context *cmd) static int _override_settings(struct cmd_context *cmd)