698723
From 354b894aa3e79f54ab75bf6fae76ce28ca80db38 Mon Sep 17 00:00:00 2001
698723
From: Lennart Poettering <lennart@poettering.net>
698723
Date: Thu, 2 Aug 2018 20:56:34 +0200
698723
Subject: [PATCH] user-runtime-dir: downgrade a few log messages to LOG_DEBUG
698723
 that we ignore
698723
698723
As the comments already say it might be quite likely that
698723
$XDG_RUNTIME_DIR is not set up as mount, and we shouldn't complain about
698723
that.
698723
698723
Moreover, let's make this idempotent, so that a runtime dir that is
698723
already gone and is removed again doesn't cause failure.
698723
698723
(cherry picked from commit 3a13442bbf72e7ebdd0b4d60c2922ea7c5cc9496)
698723
698723
Related: #1946453
698723
---
698723
 src/login/user-runtime-dir.c | 15 +++++++--------
698723
 1 file changed, 7 insertions(+), 8 deletions(-)
698723
698723
diff --git a/src/login/user-runtime-dir.c b/src/login/user-runtime-dir.c
698723
index 1bb26c99e4..9693821990 100644
698723
--- a/src/login/user-runtime-dir.c
698723
+++ b/src/login/user-runtime-dir.c
698723
@@ -95,20 +95,19 @@ static int user_remove_runtime_path(const char *runtime_path) {
698723
 
698723
         r = rm_rf(runtime_path, 0);
698723
         if (r < 0)
698723
-                log_error_errno(r, "Failed to remove runtime directory %s (before unmounting): %m", runtime_path);
698723
+                log_debug_errno(r, "Failed to remove runtime directory %s (before unmounting), ignoring: %m", runtime_path);
698723
 
698723
-        /* Ignore cases where the directory isn't mounted, as that's
698723
-         * quite possible, if we lacked the permissions to mount
698723
-         * something */
698723
+        /* Ignore cases where the directory isn't mounted, as that's quite possible, if we lacked the permissions to
698723
+         * mount something */
698723
         r = umount2(runtime_path, MNT_DETACH);
698723
         if (r < 0 && !IN_SET(errno, EINVAL, ENOENT))
698723
-                log_error_errno(errno, "Failed to unmount user runtime directory %s: %m", runtime_path);
698723
+                log_debug_errno(errno, "Failed to unmount user runtime directory %s, ignoring: %m", runtime_path);
698723
 
698723
         r = rm_rf(runtime_path, REMOVE_ROOT);
698723
-        if (r < 0)
698723
-                log_error_errno(r, "Failed to remove runtime directory %s (after unmounting): %m", runtime_path);
698723
+        if (r < 0 && r != -ENOENT)
698723
+                return log_error_errno(r, "Failed to remove runtime directory %s (after unmounting): %m", runtime_path);
698723
 
698723
-        return r;
698723
+        return 0;
698723
 }
698723
 
698723
 static int do_mount(const char *runtime_path, uid_t uid, gid_t gid) {