]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
journal: posix_fallocate() does not set errno
authorMichal Schmidt <mschmidt@redhat.com>
Thu, 5 Nov 2015 12:44:07 +0000 (13:44 +0100)
committerMichal Schmidt <mschmidt@redhat.com>
Thu, 5 Nov 2015 12:44:07 +0000 (13:44 +0100)
manpage says:
 posix_fallocate() returns zero on success, or an error number on
 failure. Note that errno is not set.

src/journal/journald-kmsg.c

index 489f6f689c933f6b79bd13d1128f26e5225caf60..c0712b5644b472dbb13db3ea5ac90aa421a605c2 100644 (file)
@@ -442,6 +442,7 @@ fail:
 int server_open_kernel_seqnum(Server *s) {
         _cleanup_close_ int fd;
         uint64_t *p;
+        int r;
 
         assert(s);
 
@@ -455,8 +456,9 @@ int server_open_kernel_seqnum(Server *s) {
                 return 0;
         }
 
-        if (posix_fallocate(fd, 0, sizeof(uint64_t)) < 0) {
-                log_error_errno(errno, "Failed to allocate sequential number file, ignoring: %m");
+        r = posix_fallocate(fd, 0, sizeof(uint64_t));
+        if (r != 0) {
+                log_error_errno(r, "Failed to allocate sequential number file, ignoring: %m");
                 return 0;
         }