mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
zpcictl: Add warning for unsupported operations
There are several reasons why an operation might fail. Either the running kernel, the PCI function itself, or the hypervisor lacks support for a certain operation. In such cases the kernel returns either with EIO or EOPNOTSUPP. The corresponding warning, however, just says the file couldn't be closed. Display a warning for EIO and EOPNOTSUPP to tell the user about the missing support. Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
@@ -171,8 +171,12 @@ static void sysfs_write_data(struct zpci_report_error *report, char *slot)
|
||||
fopen_err(path);
|
||||
if (fwrite(report, 1, r_size, fp) != r_size)
|
||||
warnx("Could not write to file: %s: %s", path, strerror(errno));
|
||||
if (fclose(fp))
|
||||
warnx("Could not close file: %s: %s", path, strerror(errno));
|
||||
if (fclose(fp)) {
|
||||
if (errno == EIO || errno == EOPNOTSUPP)
|
||||
warnx("Unsupported operation: %s: %s", path, strerror(errno));
|
||||
else
|
||||
warnx("Could not close file: %s: %s", path, strerror(errno));
|
||||
}
|
||||
free(path);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user