user-runtime-dir: deal gracefully with missing logind properties
authorLennart Poettering <lennart@poettering.net>
Wed, 19 Aug 2020 15:05:44 +0000 (17:05 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 20 Sep 2020 10:37:12 +0000 (12:37 +0200)
Fixes: #16685
(cherry picked from commit 5d1e68b49489574ef57947c5f1adfc761547eea9)
(cherry picked from commit 6cd058f305dce7aa6b20d88496b80a5dd25745d3)
(cherry picked from commit 590b9f585c77848b6df1d254dc51bb736cfc192d)

src/login/user-runtime-dir.c

index c8a56256057454036f5c510e8008387480441f9b..da1df47b7fb560dc1348be81bbe4d3a09e45d3e5 100644 (file)
@@ -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"
@@ -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;
 }