From: Yu Watanabe Date: Sun, 10 Nov 2019 05:42:55 +0000 (+0900) Subject: udev: do not append newline when write attributes X-Git-Tag: v244-rc1~74 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a566ed2c82d81cc6416fe0da0a14f6d5fe5d83b4;p=thirdparty%2Fsystemd.git udev: do not append newline when write attributes Before 25de7aa7b90c23d33ea50ada1e50c5834a414237, the content is written by `fprintf()` without new line. So WRITE_STRING_FILE_AVOID_NEWLINE flag is necessary. Fixes #13985. --- diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c index ab54067b3f1..b820072ed40 100644 --- a/src/udev/udev-rules.c +++ b/src/udev/udev-rules.c @@ -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;