Skip to content

Commit

Permalink
user-runtime-dir: downgrade a few log messages to LOG_DEBUG that we i…
Browse files Browse the repository at this point in the history
…gnore

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.
  • Loading branch information
poettering committed Aug 3, 2018
1 parent e6c7c7f commit 3a13442
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/login/user-runtime-dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,20 +95,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;
}

static int do_mount(const char *user) {
Expand Down

0 comments on commit 3a13442

Please sign in to comment.