diff options
author | mananth <mananth> | 2004-02-09 05:50:48 +0000 |
---|---|---|
committer | mananth <mananth> | 2004-02-09 05:50:48 +0000 |
commit | aa50f4d223556481b96d775a71d88eb8f848bf64 (patch) | |
tree | 7a0e0760f9ead3d71a538a688311780afb0b100e | |
parent | 6cbd7ae67a04b1f0c3269ab3aae2d8ee0efa5a89 (diff) | |
download | sysfsutils_0_5.tar.gz |
Miscellaneous fixes in sysfs_device/driver.csysfsutils_0_5
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | lib/sysfs_device.c | 4 | ||||
-rw-r--r-- | lib/sysfs_driver.c | 16 |
3 files changed, 15 insertions, 8 deletions
@@ -1,5 +1,8 @@ 02/04/2004 - Ananth Mavinakayanahalli <ananth@in.ibm.com> + * Fixed miscellaneous issues in sysfs_device/driver.c sources + +02/04/2004 - Ananth Mavinakayanahalli <ananth@in.ibm.com> * Added list sorting support * Exported get_device_bus() * Removed sysfs_open_bus_device() diff --git a/lib/sysfs_device.c b/lib/sysfs_device.c index 3b2030d..e14d12a 100644 --- a/lib/sysfs_device.c +++ b/lib/sysfs_device.c @@ -372,8 +372,10 @@ struct sysfs_root_device *sysfs_open_root_device(const unsigned char *name) */ struct dlist *sysfs_get_device_attributes(struct sysfs_device *device) { - if (device == NULL) + if (device == NULL) { + errno = EINVAL; return NULL; + } if (device->directory == NULL) { device->directory = sysfs_open_directory(device->path); diff --git a/lib/sysfs_driver.c b/lib/sysfs_driver.c index 6a7cf68..44434ee 100644 --- a/lib/sysfs_driver.c +++ b/lib/sysfs_driver.c @@ -197,12 +197,15 @@ struct dlist *sysfs_get_driver_links(struct sysfs_driver *driver) errno = EINVAL; return NULL; } - if (driver->directory == NULL) { + + if (driver->directory == NULL) if ((open_driver_dir(driver)) == 1) return NULL; + + if (driver->directory->links == NULL) if ((sysfs_read_dir_links(driver->directory)) != 0) return NULL; - } + return(driver->directory->links); } @@ -224,12 +227,11 @@ struct dlist *sysfs_get_driver_devices(struct sysfs_driver *driver) if (driver->devices != NULL) return (driver->devices); - if (driver->directory == NULL) { - if ((open_driver_dir(driver)) == 1) - return NULL; - if ((sysfs_read_dir_links(driver->directory)) != 0) - return NULL; + if (driver->directory == NULL || driver->directory->links == NULL) { + struct dlist *list = NULL; + list = sysfs_get_driver_links(driver); } + if (driver->directory->links != NULL) { dlist_for_each_data(driver->directory->links, curlink, struct sysfs_link) { |