diff --git a/utils/mqnic-fw.c b/utils/mqnic-fw.c index 0ac99473d..ba5ecf120 100644 --- a/utils/mqnic-fw.c +++ b/utils/mqnic-fw.c @@ -552,7 +552,7 @@ int main(int argc, char *argv[]) // PCIe device will have a config space, so check for that snprintf(path, sizeof(path), "%s/config", device_path); - if (access(path, F_OK) == -1) + if (access(path, F_OK)) { perror("failed to determine device path"); ret = -1; @@ -1228,7 +1228,7 @@ skip_flash: { snprintf(path, sizeof(path), "%s/driver/unbind", device_path); - if (access(path, F_OK) != -1) + if (access(path, F_OK) == 0) { printf("Unbinding driver...\n"); write_str_to_file(path, ptr+1); diff --git a/utils/mqnic.c b/utils/mqnic.c index 0477f40ba..de73a76fc 100644 --- a/utils/mqnic.c +++ b/utils/mqnic.c @@ -62,7 +62,7 @@ struct mqnic *mqnic_open(const char *dev_name) goto fail_open; } - if (fstat(dev->fd, &st) == -1) + if (fstat(dev->fd, &st)) { perror("fstat failed"); goto fail_fstat; @@ -102,7 +102,7 @@ struct mqnic *mqnic_open(const char *dev_name) strcpy(++ptr, "enable"); } - if (access(path, F_OK) != -1) + if (access(path, F_OK) == 0) { FILE *fp = fopen(path, "w");