udev: do not append newline when write attributes

Before 25de7aa7b9, the content is written
by `fprintf()` without new line. So WRITE_STRING_FILE_AVOID_NEWLINE flag
is necessary.

Fixes #13985.
This commit is contained in:
Yu Watanabe
2019-11-12 09:25:00 +01:00
committed by Zbigniew Jędrzejewski-Szmek
parent 68f98816cb
commit a566ed2c82
+1 -1
View 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;