diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2022-09-10 15:44:41 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2022-09-10 15:44:41 +0200 |
commit | a9ee361f27e0439530387765924574e5358c8a5c (patch) | |
tree | 3104aecc4d574f7d7bbb269223814586277b1797 /src/plugins/usb/usb.c | |
parent | 82ac6c87ce0b0af2fb8de25d70442fec406bb742 (diff) |
New upstream version 1.8.19upstream/1.8.19upstream
Diffstat (limited to 'src/plugins/usb/usb.c')
-rw-r--r-- | src/plugins/usb/usb.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/plugins/usb/usb.c b/src/plugins/usb/usb.c index 0049400..d6dced3 100644 --- a/src/plugins/usb/usb.c +++ b/src/plugins/usb/usb.c @@ -30,8 +30,6 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#define _BSD_SOURCE - #include <ipmitool/helper.h> #include <ipmitool/log.h> #include <ipmitool/bswap.h> @@ -123,19 +121,19 @@ scsiProbeNew(int *num_ami_devices, int *sg_nos) FILE *fp; fp = fopen("/proc/scsi/sg/device_strs", "r"); - if (fp == NULL) { + if (!fp) { /* Return 1 on error */ return 1; } while (1) { /* Read line by line and search for "AMI" */ - if (fgets(linebuf, 80, fp) == NULL) { + if (!fgets(linebuf, 80, fp)) { break; } if (sscanf(linebuf, "%s", vendor) == 1) { - if (strncmp(vendor, "AMI", strlen("AMI")) == 0) { + if (!strcmp(vendor, "AMI")) { numdevfound++; sg_nos[numdevfound - 1] = lineno; if (numdevfound == inplen) { @@ -147,7 +145,7 @@ scsiProbeNew(int *num_ami_devices, int *sg_nos) } *num_ami_devices = numdevfound; - if (fp != NULL) { + if (fp) { fclose(fp); fp = NULL; } @@ -251,7 +249,7 @@ IsG2Drive(int cd_desc) return 1; } - if (strncmp(szSignature, "$$$AMI$$$", strlen("$$$AMI$$$")) != 0) { + if (strcmp(szSignature, "$$$AMI$$$")) { lprintf(LOG_ERR, "IsG2Drive:Signature mismatch when ID command sent"); return 1; @@ -605,7 +603,7 @@ ipmi_usb_send_cmd(struct ipmi_intf *intf, struct ipmi_rq *req) rsp.ccode = rsp.data[0]; /* Save response data for caller */ - if ((rsp.ccode == 0) && (rsp.data_len > 0)) { + if (!rsp.ccode && rsp.data_len > 0) { memmove(rsp.data, rsp.data + 1, rsp.data_len - 1); rsp.data[rsp.data_len] = 0; rsp.data_len -= 1; |