]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
journal: return better error for empty files
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 25 Oct 2015 04:09:44 +0000 (00:09 -0400)
committerLennart Poettering <lennart@poettering.net>
Mon, 2 Nov 2015 23:02:00 +0000 (00:02 +0100)
When reading stuff, we should only return EIO when an actual read error
occured, not when we don't like the data for whatever reason.

We already return ENODATA for all other kinds of file truncation, hence
do the same for the most obvious kind, so that callers know what ENODATA
means.

src/journal/journal-file.c

index 12b39dbb278acd0c0b097234e773403c0423cf35..e00a0d711d8aada410c855e5c15451d05648f7dd 100644 (file)
@@ -2705,7 +2705,7 @@ int journal_file_open(
         }
 
         if (f->last_stat.st_size < (off_t) HEADER_SIZE_MIN) {
-                r = -EIO;
+                r = -ENODATA;
                 goto fail;
         }