5808e7
From a0485b96118d3d2ac439f510e404ffb3db03e23f Mon Sep 17 00:00:00 2001
5808e7
From: Yu Watanabe <watanabe.yu+github@gmail.com>
5808e7
Date: Mon, 22 Jul 2019 10:55:10 +0900
5808e7
Subject: [PATCH] pstopre: fix return value of list_files()
5808e7
5808e7
Previously, the return value of the last read_full_file() is returned.
5808e7
This makes the error in read_full_file() is always ignored.
5808e7
5808e7
(cherry picked from commit 337874a45fff46a80e4974c681a5e651f3a0fac9)
5808e7
5808e7
Related: #2158832
5808e7
---
5808e7
 src/pstore/pstore.c | 6 +++---
5808e7
 1 file changed, 3 insertions(+), 3 deletions(-)
5808e7
5808e7
diff --git a/src/pstore/pstore.c b/src/pstore/pstore.c
5808e7
index e6a342fc50..2fbef48543 100644
5808e7
--- a/src/pstore/pstore.c
5808e7
+++ b/src/pstore/pstore.c
5808e7
@@ -311,7 +311,7 @@ static void process_dmesg_files(PStoreList *list) {
5808e7
 static int list_files(PStoreList *list, const char *sourcepath) {
5808e7
         _cleanup_(closedirp) DIR *dirp = NULL;
5808e7
         struct dirent *de;
5808e7
-        int r = 0;
5808e7
+        int r;
5808e7
 
5808e7
         dirp = opendir(sourcepath);
5808e7
         if (!dirp)
5808e7
@@ -330,7 +330,7 @@ static int list_files(PStoreList *list, const char *sourcepath) {
5808e7
                 /* Now read contents of pstore file */
5808e7
                 r = read_full_file(ifd_path, &buf, &buf_size);
5808e7
                 if (r < 0) {
5808e7
-                        log_warning_errno(r, "Failed to read file %s: %m", ifd_path);
5808e7
+                        log_warning_errno(r, "Failed to read file %s, skipping: %m", ifd_path);
5808e7
                         continue;
5808e7
                 }
5808e7
 
5808e7
@@ -346,7 +346,7 @@ static int list_files(PStoreList *list, const char *sourcepath) {
5808e7
                 };
5808e7
         }
5808e7
 
5808e7
-        return r;
5808e7
+        return 0;
5808e7
 }
5808e7
 
5808e7
 static int run(int argc, char *argv[]) {