summaryrefslogtreecommitdiff
path: root/lib/sysfs_bus.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sysfs_bus.c')
-rw-r--r--lib/sysfs_bus.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/sysfs_bus.c b/lib/sysfs_bus.c
index 615407e..0a7b171 100644
--- a/lib/sysfs_bus.c
+++ b/lib/sysfs_bus.c
@@ -335,6 +335,7 @@ struct dlist *sysfs_get_bus_attributes(struct sysfs_bus *bus)
{
if (bus == NULL)
return NULL;
+
if (bus->directory == NULL) {
bus->directory = sysfs_open_directory(bus->path);
if (bus->directory == NULL)
@@ -344,6 +345,10 @@ struct dlist *sysfs_get_bus_attributes(struct sysfs_bus *bus)
if ((sysfs_read_dir_attributes(bus->directory)) != 0)
return NULL;
} else {
+ if ((sysfs_path_is_dir(bus->path)) != 0) {
+ dprintf("Bus at %s no longer exists\n", bus->path);
+ return NULL;
+ }
if ((sysfs_refresh_attributes
(bus->directory->attributes)) != 0) {
dprintf("Error refreshing bus attributes\n");