summaryrefslogtreecommitdiff
path: root/lib/ipmi_session.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ipmi_session.c')
-rw-r--r--lib/ipmi_session.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/lib/ipmi_session.c b/lib/ipmi_session.c
index b9af1fd..70a3521 100644
--- a/lib/ipmi_session.c
+++ b/lib/ipmi_session.c
@@ -288,12 +288,12 @@ ipmi_get_session_info(struct ipmi_intf * intf,
}
rsp = intf->sendrecv(intf, &req);
- if (rsp == NULL)
+ if (!rsp)
{
lprintf(LOG_ERR, "Get Session Info command failed");
retval = -1;
}
- else if (rsp->ccode > 0)
+ else if (rsp->ccode)
{
lprintf(LOG_ERR, "Get Session Info command failed: %s",
val2str(rsp->ccode, completion_code_vals));
@@ -302,10 +302,12 @@ ipmi_get_session_info(struct ipmi_intf * intf,
if (retval < 0)
{
- if ((session_request_type == IPMI_SESSION_REQUEST_CURRENT) &&
- (strncmp(intf->name, "lan", 3) != 0))
+ if (session_request_type == IPMI_SESSION_REQUEST_CURRENT
+ && strcmp(intf->name, "lan"))
+ {
lprintf(LOG_ERR, "It is likely that the channel in use "
"does not support sessions");
+ }
}
else
{
@@ -324,13 +326,13 @@ ipmi_get_session_info(struct ipmi_intf * intf,
rqdata[0] = i++;
rsp = intf->sendrecv(intf, &req);
- if (rsp == NULL)
+ if (!rsp)
{
lprintf(LOG_ERR, "Get Session Info command failed");
retval = -1;
break;
}
- else if (rsp->ccode > 0 && rsp->ccode != 0xCC && rsp->ccode != 0xCB)
+ else if (rsp->ccode && rsp->ccode != 0xCC && rsp->ccode != 0xCB)
{
lprintf(LOG_ERR, "Get Session Info command failed: %s",
val2str(rsp->ccode, completion_code_vals));
@@ -369,14 +371,14 @@ ipmi_session_main(struct ipmi_intf * intf, int argc, char ** argv)
{
int retval = 0;
- if (argc == 0 || strncmp(argv[0], "help", 4) == 0)
+ if (!argc || !strcmp(argv[0], "help"))
{
printf_session_usage();
}
- else if (strncmp(argv[0], "info", 4) == 0)
+ else if (!strcmp(argv[0], "info"))
{
- if ((argc < 2) || strncmp(argv[1], "help", 4) == 0)
+ if (argc < 2 || !strcmp(argv[1], "help"))
{
printf_session_usage();
}
@@ -385,11 +387,11 @@ ipmi_session_main(struct ipmi_intf * intf, int argc, char ** argv)
Ipmi_Session_Request_Type session_request_type = 0;
uint32_t id_or_handle = 0;
- if (strncmp(argv[1], "active", 6) == 0)
+ if (!strcmp(argv[1], "active"))
session_request_type = IPMI_SESSION_REQUEST_CURRENT;
- else if (strncmp(argv[1], "all", 3) == 0)
+ else if (!strcmp(argv[1], "all"))
session_request_type = IPMI_SESSION_REQUEST_ALL;
- else if (strncmp(argv[1], "id", 2) == 0)
+ else if (!strcmp(argv[1], "id"))
{
if (argc >= 3)
{
@@ -408,7 +410,7 @@ ipmi_session_main(struct ipmi_intf * intf, int argc, char ** argv)
retval = -1;
}
}
- else if (strncmp(argv[1], "handle", 6) == 0)
+ else if (!strcmp(argv[1], "handle"))
{
if (argc >= 3)
{