]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
journal: simplify vsnprintf() ret value check
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 10 Jun 2020 09:24:57 +0000 (11:24 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 10 Jun 2020 09:24:57 +0000 (11:24 +0200)
Follow-up for dfa64b64a7.

src/journal/journal-send.c

index 57d09e78c38e07fd4c3a24374800e978a3e631a1..d51d03acd9de09ccecb815b6002b4224e55ed2d3 100644 (file)
@@ -96,11 +96,9 @@ _public_ int sd_journal_printv(int priority, const char *format, va_list ap) {
 
         /* Allocate large buffer to accommodate big message */
         if (len >= LINE_MAX) {
-                _unused_ int rlen;
                 buffer = alloca(len + 9);
                 memcpy(buffer, "MESSAGE=", 8);
-                rlen = vsnprintf(buffer + 8, len + 1, format, ap);
-                assert(len == rlen);
+                assert_se(vsnprintf(buffer + 8, len + 1, format, ap) == len);
         }
 
         /* Strip trailing whitespace, keep prefix whitespace. */
@@ -474,11 +472,9 @@ _public_ int sd_journal_printv_with_location(int priority, const char *file, con
 
         /* Allocate large buffer to accommodate big message */
         if (len >= LINE_MAX) {
-                _unused_ int rlen;
                 buffer = alloca(len + 9);
                 memcpy(buffer, "MESSAGE=", 8);
-                rlen = vsnprintf(buffer + 8, len + 1, format, ap);
-                assert(len == rlen);
+                assert_se(vsnprintf(buffer + 8, len + 1, format, ap) == len);
         }
 
         /* Strip trailing whitespace, keep prefixing whitespace */