mirror of
https://github.com/systemd/systemd.git
synced 2024-12-23 21:35:11 +03:00
[PATCH] udev kill extra bus_id compares in match_id
Kill the extra bus_id check in match_id. This is wrong, especially since we check for rule matches with the parent devices on a given devices path. For example, given a device path of: /sys/devices/pci0000:01/0000:01:0c.0/host5/5:0:2:0 With this patch, the following rule will no longer match: BUS="scsi", ID="host5", NAME="sd-bus_id-host5"
This commit is contained in:
parent
7b1cbec91a
commit
5a42932b9a
19
namedev.c
19
namedev.c
@ -469,32 +469,19 @@ static int match_sysfs_pairs(struct config_device *dev, struct sysfs_class_devic
|
||||
static int match_id(struct config_device *dev, struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device)
|
||||
{
|
||||
char path[SYSFS_PATH_MAX];
|
||||
int found;
|
||||
char *temp = NULL;
|
||||
|
||||
/* we have to have a sysfs device for ID to work */
|
||||
if (!sysfs_device)
|
||||
return -ENODEV;
|
||||
|
||||
found = 0;
|
||||
strfieldcpy(path, sysfs_device->path);
|
||||
temp = strrchr(path, '/');
|
||||
dbg("search '%s' in '%s', path='%s'", dev->id, temp, path);
|
||||
if (strstr(temp, dev->id) != NULL) {
|
||||
found = 1;
|
||||
} else {
|
||||
*temp = 0x00;
|
||||
temp = strrchr(path, '/');
|
||||
dbg("search '%s' in '%s', path='%s'", dev->id, temp, path);
|
||||
if (strstr(temp, dev->id) != NULL)
|
||||
found = 1;
|
||||
}
|
||||
if (!found) {
|
||||
dbg("id doesn't match");
|
||||
if (strstr(temp, dev->id) == NULL)
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
return 0;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int match_place(struct config_device *dev, struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device)
|
||||
|
Loading…
Reference in New Issue
Block a user