diff options
Diffstat (limited to '')
-rw-r--r-- | lib/sysfs.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/lib/sysfs.c b/lib/sysfs.c index cd2379e..0e763dc 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -105,12 +105,13 @@ sysfs_get_string(struct pci_dev *d, char *object, char *buf, int mandatory) return 0; } n = read(fd, buf, OBJBUFSIZE); + int read_errno = errno; close(fd); if (n < 0) { - warn("Error reading %s: %s", namebuf, strerror(errno)); + warn("Error reading %s: %s", namebuf, strerror(read_errno)); return 0; - } + } if (n >= OBJBUFSIZE) { warn("Value in %s too long", namebuf); @@ -593,17 +594,16 @@ static void sysfs_cleanup_dev(struct pci_dev *d) } struct pci_methods pm_linux_sysfs = { - "linux-sysfs", - "The sys filesystem on Linux", - sysfs_config, - sysfs_detect, - sysfs_init, - sysfs_cleanup, - sysfs_scan, - sysfs_fill_info, - sysfs_read, - sysfs_write, - sysfs_read_vpd, - NULL, /* init_dev */ - sysfs_cleanup_dev + .name = "linux-sysfs", + .help = "The sys filesystem on Linux", + .config = sysfs_config, + .detect = sysfs_detect, + .init = sysfs_init, + .cleanup = sysfs_cleanup, + .scan = sysfs_scan, + .fill_info = sysfs_fill_info, + .read = sysfs_read, + .write = sysfs_write, + .read_vpd = sysfs_read_vpd, + .cleanup_dev = sysfs_cleanup_dev, }; |