]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
udev: use path_startswith() instead of startswith() in two more cases
authorLennart Poettering <lennart@poettering.net>
Wed, 26 Aug 2020 15:22:06 +0000 (17:22 +0200)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 27 Aug 2020 07:16:43 +0000 (16:16 +0900)
src/udev/udev-rules.c
src/udev/udevadm-test.c

index c36f032f6622ba25625a86b4d18855384621cca1..eb28431325b55948e2bc1bb5bcf938466c196dea 100644 (file)
@@ -2038,7 +2038,7 @@ static int udev_rule_apply_token_to_event(
                 }
                 if (sd_device_get_devnum(dev, NULL) >= 0 &&
                     (sd_device_get_devname(dev, &val) < 0 ||
-                     !streq_ptr(buf, startswith(val, "/dev/")))) {
+                     !streq_ptr(buf, path_startswith(val, "/dev/")))) {
                         log_rule_error(dev, rules,
                                        "Kernel device nodes cannot be renamed, ignoring NAME=\"%s\"; please fix it.",
                                        token->value);
index 5b9b65439ad30f5c4ce8fed9259f1f243b7e557f..53d49059927ff0c6880541f1a5408fb77dd45392 100644 (file)
@@ -17,6 +17,7 @@
 #include "device-private.h"
 #include "device-util.h"
 #include "libudev-util.h"
+#include "path-util.h"
 #include "string-util.h"
 #include "strxcpyx.h"
 #include "udev-builtin.h"
@@ -90,7 +91,7 @@ static int parse_argv(int argc, char *argv[]) {
                                        "syspath parameter missing.");
 
         /* add /sys if needed */
-        if (!startswith(argv[optind], "/sys"))
+        if (!path_startswith(argv[optind], "/sys"))
                 strscpyl(arg_syspath, sizeof(arg_syspath), "/sys", argv[optind], NULL);
         else
                 strscpy(arg_syspath, sizeof(arg_syspath), argv[optind]);