summaryrefslogtreecommitdiffstats
path: root/lib/sysfs.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 18:31:40 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 18:31:40 +0000
commit6cddab6f801ceb7056b2d061c125a525b020e8ab (patch)
treeaa2d9a14a3ff214a2b3f184557af4605ff301fd8 /lib/sysfs.c
parentAdding upstream version 1:3.11.1. (diff)
downloadpciutils-6cddab6f801ceb7056b2d061c125a525b020e8ab.tar.xz
pciutils-6cddab6f801ceb7056b2d061c125a525b020e8ab.zip
Adding upstream version 1:3.12.0.upstream/1%3.12.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'lib/sysfs.c')
-rw-r--r--lib/sysfs.c30
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,
};