From: Lennart Poettering Date: Wed, 26 Aug 2020 15:22:06 +0000 (+0200) Subject: udev: use path_startswith() instead of startswith() in two more cases X-Git-Tag: v247-rc1~358 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=25f3b27270e53d5c0a9aa2831d1da305b169c471;p=thirdparty%2Fsystemd.git udev: use path_startswith() instead of startswith() in two more cases --- diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c index c36f032f662..eb28431325b 100644 --- a/src/udev/udev-rules.c +++ b/src/udev/udev-rules.c @@ -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); diff --git a/src/udev/udevadm-test.c b/src/udev/udevadm-test.c index 5b9b65439ad..53d49059927 100644 --- a/src/udev/udevadm-test.c +++ b/src/udev/udevadm-test.c @@ -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]);