summaryrefslogtreecommitdiff
path: root/udev_sysfs.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2007-06-02 22:00:10 +0200
committerKay Sievers <kay.sievers@vrfy.org>2007-06-02 22:00:10 +0200
commit03178b0ccec2d4eed7e57563f17fc60adc0a4446 (patch)
tree2480557ce66f41a13c863bdae2f08f71d1482656 /udev_sysfs.c
parentdf97701ec607a81e5724b7ac2c9b9511fa22ee45 (diff)
sysfs: change order of subsystem lookup
Diffstat (limited to 'udev_sysfs.c')
-rw-r--r--udev_sysfs.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/udev_sysfs.c b/udev_sysfs.c
index 8525620a09..98be9a5352 100644
--- a/udev_sysfs.c
+++ b/udev_sysfs.c
@@ -446,16 +446,16 @@ int sysfs_lookup_devpath_by_subsys_id(char *devpath_full, size_t len, const char
if (stat(path_full, &statbuf) == 0)
goto found;
- strlcpy(path, "/class/", sizeof(path_full) - sysfs_len);
+ strlcpy(path, "/bus/", sizeof(path_full) - sysfs_len);
strlcat(path, id, sizeof(path_full) - sysfs_len);
if (stat(path_full, &statbuf) == 0)
goto found;
+ goto out;
- strlcpy(path, "/bus/", sizeof(path_full) - sysfs_len);
+ strlcpy(path, "/class/", sizeof(path_full) - sysfs_len);
strlcat(path, id, sizeof(path_full) - sysfs_len);
if (stat(path_full, &statbuf) == 0)
goto found;
- goto out;
}
if (strcmp(subsystem, "module") == 0) {
@@ -499,22 +499,21 @@ int sysfs_lookup_devpath_by_subsys_id(char *devpath_full, size_t len, const char
if (stat(path_full, &statbuf) == 0)
goto found;
- strlcpy(path, "/class/", sizeof(path_full) - sysfs_len);
+ strlcpy(path, "/bus/", sizeof(path_full) - sysfs_len);
strlcat(path, subsystem, sizeof(path_full) - sysfs_len);
- strlcat(path, "/", sizeof(path_full) - sysfs_len);
+ strlcat(path, "/devices/", sizeof(path_full) - sysfs_len);
strlcat(path, id, sizeof(path_full) - sysfs_len);
if (stat(path_full, &statbuf) == 0)
goto found;
- strlcpy(path, "/bus/", sizeof(path_full) - sysfs_len);
+ strlcpy(path, "/class/", sizeof(path_full) - sysfs_len);
strlcat(path, subsystem, sizeof(path_full) - sysfs_len);
- strlcat(path, "/devices/", sizeof(path_full) - sysfs_len);
+ strlcat(path, "/", sizeof(path_full) - sysfs_len);
strlcat(path, id, sizeof(path_full) - sysfs_len);
if (stat(path_full, &statbuf) == 0)
goto found;
out:
return 0;
-
found:
if (S_ISLNK(statbuf.st_mode))
sysfs_resolve_link(path, sizeof(path_full) - sysfs_len);