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