From a9ee361f27e0439530387765924574e5358c8a5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sat, 10 Sep 2022 15:44:41 +0200 Subject: New upstream version 1.8.19 --- src/plugins/usb/usb.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src/plugins/usb/usb.c') 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 #include #include @@ -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; -- cgit v1.2.3