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