summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-08-02 20:56:34 +0200
committerSven Eden <sven.eden@prydeworx.com>2018-10-29 10:18:25 +0100
commit4b5652fb033e51fe8194b11054f54a603086824e (patch)
treee835d8d6cf4d9e9bcb17b8a927ad4eac1c81fce0
parentff04443a773f4339f3be98e05e3f0ecc0c45d2ce (diff)
user-runtime-dir: downgrade a few log messages to LOG_DEBUG that we ignore
As the comments already say it might be quite likely that $XDG_RUNTIME_DIR is not set up as mount, and we shouldn't complain about that. Moreover, let's make this idempotent, so that a runtime dir that is already gone and is removed again doesn't cause failure. (cherry picked from commit 3a13442bbf72e7ebdd0b4d60c2922ea7c5cc9496)
-rw-r--r--src/login/user-runtime-dir.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/login/user-runtime-dir.c b/src/login/user-runtime-dir.c
index 930b1a99a..9dde42c30 100644
--- a/src/login/user-runtime-dir.c
+++ b/src/login/user-runtime-dir.c
@@ -99,20 +99,19 @@ static int user_remove_runtime_path(const char *runtime_path) {
r = rm_rf(runtime_path, 0);
if (r < 0)
- log_error_errno(r, "Failed to remove runtime directory %s (before unmounting): %m", runtime_path);
+ log_debug_errno(r, "Failed to remove runtime directory %s (before unmounting), ignoring: %m", runtime_path);
- /* Ignore cases where the directory isn't mounted, as that's
- * quite possible, if we lacked the permissions to mount
- * something */
+ /* Ignore cases where the directory isn't mounted, as that's quite possible, if we lacked the permissions to
+ * mount something */
r = umount2(runtime_path, MNT_DETACH);
if (r < 0 && !IN_SET(errno, EINVAL, ENOENT))
- log_error_errno(errno, "Failed to unmount user runtime directory %s: %m", runtime_path);
+ log_debug_errno(errno, "Failed to unmount user runtime directory %s, ignoring: %m", runtime_path);
r = rm_rf(runtime_path, REMOVE_ROOT);
- if (r < 0)
- log_error_errno(r, "Failed to remove runtime directory %s (after unmounting): %m", runtime_path);
+ if (r < 0 && r != -ENOENT)
+ return log_error_errno(r, "Failed to remove runtime directory %s (after unmounting): %m", runtime_path);
- return r;
+ return 0;
}
#if 0 /// having a User instance, elogind can ask its manager directly.