summaryrefslogtreecommitdiff
path: root/udev-add.c
diff options
context:
space:
mode:
authorgreg@kroah.com <greg@kroah.com>2003-10-17 19:26:07 -0700
committerGreg KH <gregkh@suse.de>2005-04-26 21:01:41 -0700
commit1c596cc0a5357105a80ab07f0ebbe2eb330b2c28 (patch)
treea20c5b58af86458360963661b5cfb97e57821eb4 /udev-add.c
parent22b000237951ce98b2ab77540e4bf2e6b1e91582 (diff)
[PATCH] fix segfaults when dealing with partitions.
Diffstat (limited to 'udev-add.c')
-rw-r--r--udev-add.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/udev-add.c b/udev-add.c
index 48979393a5..6060bcf5f7 100644
--- a/udev-add.c
+++ b/udev-add.c
@@ -169,13 +169,13 @@ int udev_add_device(char *device, char *subsystem)
}
memset(&dbdev, 0, sizeof(dbdev));
strncpy(dbdev.name, attr.name, NAME_SIZE);
- strncpy(dbdev.sysfs_path, class_dev->sysdevice->directory->path,
- PATH_SIZE);
+ if (class_dev->sysdevice) {
+ strncpy(dbdev.sysfs_path, class_dev->sysdevice->directory->path, PATH_SIZE);
+ strncpy(dbdev.bus_id, class_dev->sysdevice->bus_id, ID_SIZE);
+ }
strncpy(dbdev.class_dev_name, class_dev->name, NAME_SIZE);
- if ((sysfs_get_name_from_path(subsystem, dbdev.class_name, NAME_SIZE))
- != 0)
+ if ((sysfs_get_name_from_path(subsystem, dbdev.class_name, NAME_SIZE)) != 0)
strcpy(dbdev.class_name, "unkown");
- strncpy(dbdev.bus_id, class_dev->sysdevice->bus_id, ID_SIZE);
strcpy(dbdev.bus_name, "unknown");
if (class_dev->driver != NULL)
strncpy(dbdev.driver, class_dev->driver->name, NAME_SIZE);