From: greg@kroah.com Date: Thu, 13 Nov 2003 01:56:26 +0000 (-0800) Subject: [PATCH] fix bug where NUMBER and TOPOLOGY would not work for partitions. X-Git-Tag: 006~34 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=8a0c11d360a5c07f200cb421c5a4291dd00d5a09;hp=7bd22a78a1a75857330031db44c68d07b049e809;p=elogind.git [PATCH] fix bug where NUMBER and TOPOLOGY would not work for partitions. --- diff --git a/namedev.c b/namedev.c index 2176e8ba7..140d50079 100644 --- a/namedev.c +++ b/namedev.c @@ -608,6 +608,7 @@ static int get_attr(struct sysfs_class_device *class_dev, struct udevice *udev) udev->mode = 0; /* find the sysfs_device for this class device */ + /* Wouldn't it really be nice if libsysfs could do this for us? */ if (class_dev->sysdevice) { sysfs_device = class_dev->sysdevice; } else { @@ -691,12 +692,11 @@ label_found: case NUMBER: { char path[SYSFS_PATH_MAX]; - char *temp; found = 0; - if (!class_dev->sysdevice) + if (!sysfs_device) continue; - strcpy(path, class_dev->sysdevice->path); + strcpy(path, sysfs_device->path); temp = strrchr(path, '/'); dbg_parse("NUMBER path = '%s'", path); dbg_parse("NUMBER temp = '%s' id = '%s'", temp, dev->id); @@ -727,12 +727,11 @@ label_found: case TOPOLOGY: { char path[SYSFS_PATH_MAX]; - char *temp; - if (!class_dev->sysdevice) + if (!sysfs_device) continue; found = 0; - strcpy(path, class_dev->sysdevice->path); + strcpy(path, sysfs_device->path); temp = strrchr(path, '/'); dbg_parse("TOPOLOGY path = '%s'", path); dbg_parse("TOPOLOGY temp = '%s' place = '%s'", temp, dev->place);