]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
loop-util: let's cut trailing whitespace, not trailing lines
authorLennart Poettering <lennart@poettering.net>
Tue, 5 Apr 2022 14:58:32 +0000 (16:58 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 7 Apr 2022 16:55:58 +0000 (18:55 +0200)
This doesn't really make any real difference, given the file should only
contain a single line. But it's conceptually more correct to just remove
the trailing newline/whitespace then the whole lines coming after that.
i.e. if the file actually contains more lines than one, this should
probably be considered an error.

src/shared/loop-util.c

index 6356ff44d8c1002a5cc2e5ae1fb74b5f678ece1a..026adf070d36df8f2f19564aa08e7c7cfec8a316 100644 (file)
@@ -62,9 +62,7 @@ static int get_current_uevent_seqnum(uint64_t *ret) {
         if (r < 0)
                 return log_debug_errno(r, "Failed to read current uevent sequence number: %m");
 
-        truncate_nl(p);
-
-        r = safe_atou64(p, ret);
+        r = safe_atou64(strstrip(p), ret);
         if (r < 0)
                 return log_debug_errno(r, "Failed to parse current uevent sequence number: %s", p);