daandemeyer / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
923a60
From fcef41057f40008693dd9161c973c2c6117e1433 Mon Sep 17 00:00:00 2001
923a60
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
923a60
Date: Sun, 25 Oct 2015 00:09:44 -0400
923a60
Subject: [PATCH] journal: return better error for empty files
923a60
923a60
When reading stuff, we should only return EIO when an actual read error
923a60
occured, not when we don't like the data for whatever reason.
923a60
923a60
We already return ENODATA for all other kinds of file truncation, hence
923a60
do the same for the most obvious kind, so that callers know what ENODATA
923a60
means.
923a60
923a60
(cherry picked from commit cfb571f30fd415304b2f674f1615dc861058c347)
923a60
923a60
Related: #1465759
923a60
---
923a60
 src/journal/journal-file.c | 2 +-
923a60
 1 file changed, 1 insertion(+), 1 deletion(-)
923a60
923a60
diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
923a60
index ebc8e62305..2bb3a97574 100644
923a60
--- a/src/journal/journal-file.c
923a60
+++ b/src/journal/journal-file.c
923a60
@@ -2693,7 +2693,7 @@ int journal_file_open(
923a60
         }
923a60
 
923a60
         if (f->last_stat.st_size < (off_t) HEADER_SIZE_MIN) {
923a60
-                r = -EIO;
923a60
+                r = -ENODATA;
923a60
                 goto fail;
923a60
         }
923a60