Cleaned up return codes for invalid arguments passed to sub-commands.

This commit is contained in:
Jeremy Ellington 2006-06-20 19:48:53 +00:00
parent 070f36d1ae
commit b3d2bb937d
5 changed files with 18 additions and 8 deletions

View File

@ -2115,6 +2115,7 @@ ipmi_lanp_main(struct ipmi_intf * intf, int argc, char ** argv)
else
{
lprintf(LOG_NOTICE, "Invalid LAN command: %s", argv[0]);
rc = -1;
}
return rc;
}

View File

@ -564,9 +564,13 @@ ipmi_mc_main(struct ipmi_intf * intf, int argc, char ** argv)
else if (strncmp(argv[0], "setenables", 10) == 0) {
rc = ipmi_mc_set_enables(intf, argc-1, &(argv[1]));
}
else if (!strncmp(argv[0], "selftest", 8)) {
else if (!strncmp(argv[0], "selftest", 8)) {
rc = ipmi_mc_get_selftest(intf);
}
else {
lprintf(LOG_ERR, "Invalid mc/bmc command: %s", argv[0]);
rc = -1;
}
return rc;
}

View File

@ -845,6 +845,7 @@ int ipmi_pef_main(struct ipmi_intf * intf, int argc, char ** argv)
// PEF subcommand handling
*/
int help = 0;
int rc = 0;
if (!argc || !strncmp(argv[0], "info", 4))
ipmi_pef_get_info(intf);
@ -858,11 +859,14 @@ int ipmi_pef_main(struct ipmi_intf * intf, int argc, char ** argv)
ipmi_pef_list_entries(intf);
else {
help = 1;
rc = -1;
lprintf(LOG_ERR, "Invalid PEF command: '%s'\n", argv[0]);
}
if (help)
lprintf(LOG_NOTICE, "PEF commands: info status policy list");
else if (!verbose)
printf("\n");
return 0;
return rc;
}

View File

@ -1106,7 +1106,7 @@ ipmi_sol_deactivate(struct ipmi_intf * intf)
struct ipmi_rq req;
uint8_t data[6];
memset(&req, 0, sizeof(req));
memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_APP;
req.msg.cmd = IPMI_DEACTIVATE_PAYLOAD;
req.msg.data_len = 6;

View File

@ -815,12 +815,13 @@ ipmi_user_main(struct ipmi_intf * intf, int argc, char ** argv)
0); /* This field is ignored */
}
else
{
retval = -1;
lprintf(LOG_ERR, "Invalid user command: '%s'\n", argv[0]);
print_user_usage();
}
else
{
print_user_usage();
}
return retval;
}