chiark / gitweb /
udev: use startswith() and streq()
[elogind.git] / src / udev / udevadm-trigger.c
index 36a2864..7735e4b 100644 (file)
@@ -38,7 +38,6 @@ static int dry_run;
 
 static void exec_list(struct udev_enumerate *udev_enumerate, const char *action)
 {
-        struct udev *udev = udev_enumerate_get_udev(udev_enumerate);
         struct udev_list_entry *entry;
 
         udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(udev_enumerate)) {
@@ -165,8 +164,8 @@ static int adm_trigger(struct udev *udev, int argc, char *argv[])
                         struct udev_device *dev;
 
                         /* add sys dir if needed */
-                        if (strncmp(optarg, udev_get_sys_path(udev), strlen(udev_get_sys_path(udev))) != 0)
-                                util_strscpyl(path, sizeof(path), udev_get_sys_path(udev), optarg, NULL);
+                        if (!startswith(optarg, "/sys"))
+                                util_strscpyl(path, sizeof(path), "/sys", optarg, NULL);
                         else
                                 util_strscpy(path, sizeof(path), optarg);
                         util_remove_trailing_chars(path, '/');