summaryrefslogtreecommitdiff
path: root/udevinfo.c
diff options
context:
space:
mode:
authorGreg KH <gregkh@suse.de>2005-06-06 13:46:19 -0700
committerGreg KH <greg@press.(none)>2005-06-06 13:46:19 -0700
commite2bd03ff63789e0ffcc1955f15d9927f3ce87465 (patch)
tree137cf86f82bc77cf404675f6aa94decc3ac1c0fc /udevinfo.c
parent5e65ab9a191268fec7cddf6b7d8c0fefd2a6b920 (diff)
Fix udevinfo for empty sysfs directories
udevinfo would die if it ran into a sysfs directory with no attributes. This is valid for a lot of scsi devices, so now we just continue on up the chain. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'udevinfo.c')
-rw-r--r--udevinfo.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/udevinfo.c b/udevinfo.c
index 31e719fe35..69e5335b7c 100644
--- a/udevinfo.c
+++ b/udevinfo.c
@@ -152,19 +152,16 @@ static int print_device_chain(const char *path)
/* look the device chain upwards */
while (sysfs_dev != NULL) {
- attr_list = sysfs_get_device_attributes(sysfs_dev);
- if (attr_list == NULL) {
- fprintf(stderr, "couldn't open device directory\n");
- retval = -1;
- goto exit;
- }
-
printf(" looking at the device chain at '%s':\n", sysfs_dev->path);
printf(" BUS==\"%s\"\n", sysfs_dev->bus);
printf(" ID==\"%s\"\n", sysfs_dev->bus_id);
printf(" DRIVER==\"%s\"\n", sysfs_dev->driver_name);
- print_all_attributes(attr_list);
+ attr_list = sysfs_get_device_attributes(sysfs_dev);
+ if (attr_list != NULL)
+ print_all_attributes(attr_list);
+ else
+ printf("\n");
sysfs_dev = sysfs_get_device_parent(sysfs_dev);
if (sysfs_dev == NULL)