Skip to content

Commit

Permalink
user-runtime-dir: deal gracefully with missing logind properties
Browse files Browse the repository at this point in the history
Fixes: #16685
(cherry picked from commit 5d1e68b)
(cherry picked from commit 6cd058f)
(cherry picked from commit 590b9f5)
  • Loading branch information
poettering authored and keszybz committed Sep 20, 2020
1 parent 11a97bc commit 677fb2b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/login/user-runtime-dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@
#include "sd-bus.h"

#include "bus-error.h"
#include "dev-setup.h"
#include "fs-util.h"
#include "format-util.h"
#include "fs-util.h"
#include "label.h"
#include "limits-util.h"
#include "main-func.h"
#include "mkdir.h"
#include "mountpoint-util.h"
Expand All @@ -31,8 +34,10 @@ static int acquire_runtime_dir_size(uint64_t *ret) {
return log_error_errno(r, "Failed to connect to system bus: %m");

r = sd_bus_get_property_trivial(bus, "org.freedesktop.login1", "/org/freedesktop/login1", "org.freedesktop.login1.Manager", "RuntimeDirectorySize", &error, 't', ret);
if (r < 0)
return log_error_errno(r, "Failed to acquire runtime directory size: %s", bus_error_message(&error, r));
if (r < 0) {
log_warning_errno(r, "Failed to acquire runtime directory size, ignoring: %s", bus_error_message(&error, r));
*ret = physical_memory_scale(10U, 100U); /* 10% */
}

return 0;
}
Expand Down

0 comments on commit 677fb2b

Please sign in to comment.