]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
udev: do not append newline when write attributes
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 10 Nov 2019 05:42:55 +0000 (14:42 +0900)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 12 Nov 2019 08:25:00 +0000 (09:25 +0100)
Before 25de7aa7b90c23d33ea50ada1e50c5834a414237, the content is written
by `fprintf()` without new line. So WRITE_STRING_FILE_AVOID_NEWLINE flag
is necessary.

Fixes #13985.

src/udev/udev-rules.c

index ab54067b3f16232c030b906d6e19a01d71737e92..b820072ed40311fb73fc4caf2ee7587e501f25cd 100644 (file)
@@ -2102,7 +2102,7 @@ static int udev_rule_apply_token_to_event(
                 (void) udev_event_apply_format(event, token->value, value, sizeof(value), false);
 
                 log_rule_debug(dev, rules, "ATTR '%s' writing '%s'", buf, value);
-                r = write_string_file(buf, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_DISABLE_BUFFER);
+                r = write_string_file(buf, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_DISABLE_BUFFER | WRITE_STRING_FILE_AVOID_NEWLINE);
                 if (r < 0)
                         log_rule_error_errno(dev, rules, r, "Failed to write ATTR{%s}, ignoring: %m", buf);
                 break;