]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-device: drop unwanted newline in netlink message
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 16 Nov 2020 15:51:14 +0000 (00:51 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 17 Nov 2020 20:32:44 +0000 (05:32 +0900)
src/libsystemd/sd-device/device-private.c

index c5bf9b3323b546fa59a66599d9be605e5e339c9a..1c7bb033d31ff8074a75046e7a14d231dc672f61 100644 (file)
@@ -468,6 +468,10 @@ int device_new_from_nulstr(sd_device **ret, uint8_t *nulstr, size_t len) {
 
                 i += end - key + 1;
 
+                /* netlink messages for some devices contain an unwanted newline at the end of value.
+                 * Let's drop the newline and remaining characters after the newline. */
+                truncate_nl(key);
+
                 r = device_append(device, key, &major, &minor);
                 if (r < 0)
                         return r;