dryang / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
ff2b41
From 5b7b538fcd268288cea8d8b7f16f839afbf74f39 Mon Sep 17 00:00:00 2001
ff2b41
From: Lennart Poettering <lennart@poettering.net>
ff2b41
Date: Wed, 28 Nov 2018 12:41:44 +0100
ff2b41
Subject: [PATCH] mount: don't propagate errors from mount_setup_unit() further
ff2b41
 up
ff2b41
ff2b41
If we can't process a specific line in /proc/self/mountinfo we should
ff2b41
log about it (which we do), but this should not affect other lines, nor
ff2b41
further processing of mount units. Let's keep these failures local.
ff2b41
ff2b41
Fixes: #10874
ff2b41
(cherry picked from commit ba0d56f55f2073164799be714b5bd1aad94d059a)
ff2b41
Resolves: #1809159
ff2b41
---
ff2b41
 src/core/mount.c | 9 +++------
ff2b41
 1 file changed, 3 insertions(+), 6 deletions(-)
ff2b41
ff2b41
diff --git a/src/core/mount.c b/src/core/mount.c
ff2b41
index 3167bd6bb1..126038c27f 100644
ff2b41
--- a/src/core/mount.c
ff2b41
+++ b/src/core/mount.c
ff2b41
@@ -1571,7 +1571,7 @@ fail:
ff2b41
 static int mount_load_proc_self_mountinfo(Manager *m, bool set_flags) {
ff2b41
         _cleanup_(mnt_free_tablep) struct libmnt_table *t = NULL;
ff2b41
         _cleanup_(mnt_free_iterp) struct libmnt_iter *i = NULL;
ff2b41
-        int r = 0;
ff2b41
+        int r;
ff2b41
 
ff2b41
         assert(m);
ff2b41
 
ff2b41
@@ -1587,7 +1587,6 @@ static int mount_load_proc_self_mountinfo(Manager *m, bool set_flags) {
ff2b41
         if (r < 0)
ff2b41
                 return log_error_errno(r, "Failed to parse /proc/self/mountinfo: %m");
ff2b41
 
ff2b41
-        r = 0;
ff2b41
         for (;;) {
ff2b41
                 const char *device, *path, *options, *fstype;
ff2b41
                 _cleanup_free_ const char *d = NULL, *p = NULL;
ff2b41
@@ -1615,12 +1614,10 @@ static int mount_load_proc_self_mountinfo(Manager *m, bool set_flags) {
ff2b41
 
ff2b41
                 (void) device_found_node(m, d, true, DEVICE_FOUND_MOUNT, set_flags);
ff2b41
 
ff2b41
-                k = mount_setup_unit(m, d, p, options, fstype, set_flags);
ff2b41
-                if (r == 0 && k < 0)
ff2b41
-                        r = k;
ff2b41
+                (void) mount_setup_unit(m, d, p, options, fstype, set_flags);
ff2b41
         }
ff2b41
 
ff2b41
-        return r;
ff2b41
+        return 0;
ff2b41
 }
ff2b41
 
ff2b41
 static void mount_shutdown(Manager *m) {