]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-device: keep escaped strings in DEVLINK= property
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 6 Dec 2020 12:10:34 +0000 (21:10 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 8 Dec 2020 03:35:47 +0000 (12:35 +0900)
This fixes a bug introduced by 87a4d416e5126b6fb2528ae192a6a6a8033539ce.

Fixes #17772.

src/libsystemd/sd-device/device-private.c

index 2801ebdcbe32080a929d574d562ac3b9d2777527..9070dfbdd1144f2dcf889aa415391667e2ae7a64 100644 (file)
@@ -319,7 +319,10 @@ static int device_amend(sd_device *device, const char *key, const char *value) {
                 for (const char *p = value;;) {
                         _cleanup_free_ char *word = NULL;
 
-                        r = extract_first_word(&p, &word, NULL, 0);
+                        /* udev rules may set escaped strings, and sd-device does not modify the input
+                         * strings. So, it is also necessary to keep the strings received through
+                         * sd-device-monitor. */
+                        r = extract_first_word(&p, &word, NULL, EXTRACT_RETAIN_ESCAPE);
                         if (r < 0)
                                 return r;
                         if (r == 0)