zpcictl: Fix compile warning

zpcictl.c: In function ‘sysfs_read_value’:
zpcictl.c:154:2: warning: ignoring return value of ‘fscanf’, declared with
attribute warn_unused_result [-Wunused-result]
  fscanf(fp, "%x", &val);
  ^~~~~~~~~~~~~~~~~~~~~~

Reviewed-by: Stefan Haberland <sth@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Jan Höppner
2019-05-20 16:34:09 +02:00
parent f97d048643
commit 73bab8e1a1

View File

@@ -151,7 +151,12 @@ static unsigned int sysfs_read_value(struct zpci_device *pdev, const char *attr)
fp = fopen(path, "r");
if (!fp)
fopen_err(path);
fscanf(fp, "%x", &val);
if (fscanf(fp, "%x", &val) != 1) {
fclose(fp);
warnx("Could not read file %s: %s", path, strerror(errno));
free(path);
exit(EXIT_FAILURE);
}
fclose(fp);
free(path);