From foo@baz Tue Apr 9 12:12:43 2002 To: Greg KH Date: 17 Oct 2003 11:26:07 -07:00 From: greg@kroah.com Subject: fix segfaults when dealing with partitions. diff -Nru a/udev-add.c b/udev-add.c --- a/udev-add.c Fri Oct 17 11:26:37 2003 +++ b/udev-add.c Fri Oct 17 11:26:37 2003 @@ -169,13 +169,13 @@ } 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);