summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/login/meson.build1
-rw-r--r--src/login/user-runtime-dir.c37
2 files changed, 24 insertions, 14 deletions
diff --git a/src/login/meson.build b/src/login/meson.build
index f8c536464..81f39e1ea 100644
--- a/src/login/meson.build
+++ b/src/login/meson.build
@@ -83,7 +83,6 @@ loginctl_sources = files('''
#if 0 /// UNNEEDED by elogind
# user_runtime_dir_sources = files('''
# user-runtime-dir.c
-# logind.h
# '''.split())
#endif // 0
diff --git a/src/login/user-runtime-dir.c b/src/login/user-runtime-dir.c
index 3ba4af3f2..d482f8237 100644
--- a/src/login/user-runtime-dir.c
+++ b/src/login/user-runtime-dir.c
@@ -3,9 +3,11 @@
#include <stdint.h>
#include <sys/mount.h>
+//#include "sd-bus.h"
+
+//#include "bus-error.h"
#include "fs-util.h"
#include "label.h"
-//#include "logind.h"
#include "mkdir.h"
#include "mount-util.h"
#include "path-util.h"
@@ -20,22 +22,29 @@
#include "user-runtime-dir.h"
#if 0 /// UNNEEDED by elogind
-static int gather_configuration(size_t *runtime_dir_size) {
- Manager m = {};
+static int acquire_runtime_dir_size(uint64_t *ret) {
+ _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
+ _cleanup_(sd_bus_unrefp) sd_bus *bus = NULL;
int r;
- manager_reset_config(&m);
+ r = sd_bus_default_system(&bus);
+ if (r < 0)
+ return log_error_errno(r, "Failed to connect to system bus: %m");
- r = manager_parse_config_file(&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)
- log_warning_errno(r, "Failed to parse logind.conf: %m");
+ return log_error_errno(r, "Failed to acquire runtime directory size: %s", bus_error_message(&error, r));
- *runtime_dir_size = m.runtime_dir_size;
return 0;
}
#endif // 0
-static int user_mkdir_runtime_path(const char *runtime_path, uid_t uid, gid_t gid, size_t runtime_dir_size) {
+static int user_mkdir_runtime_path(
+ const char *runtime_path,
+ uid_t uid,
+ gid_t gid,
+ uint64_t runtime_dir_size) {
+
int r;
assert(runtime_path);
@@ -53,10 +62,10 @@ static int user_mkdir_runtime_path(const char *runtime_path, uid_t uid, gid_t gi
char options[sizeof("mode=0700,uid=,gid=,size=,smackfsroot=*")
+ DECIMAL_STR_MAX(uid_t)
+ DECIMAL_STR_MAX(gid_t)
- + DECIMAL_STR_MAX(size_t)];
+ + DECIMAL_STR_MAX(uint64_t)];
xsprintf(options,
- "mode=0700,uid=" UID_FMT ",gid=" GID_FMT ",size=%zu%s",
+ "mode=0700,uid=" UID_FMT ",gid=" GID_FMT ",size=%" PRIu64 "%s",
uid, gid, runtime_dir_size,
mac_smack_use() ? ",smackfsroot=*" : "");
@@ -118,7 +127,7 @@ static int user_remove_runtime_path(const char *runtime_path) {
#if 0 /// having a User instance, elogind can ask its manager directly.
static int do_mount(const char *user) {
char runtime_path[sizeof("/run/user") + DECIMAL_STR_MAX(uid_t)];
- size_t runtime_dir_size;
+ uint64_t runtime_dir_size;
uid_t uid;
gid_t gid;
int r;
@@ -131,9 +140,11 @@ static int do_mount(const char *user) {
: "Failed to look up user \"%s\": %m",
user);
- xsprintf(runtime_path, "/run/user/" UID_FMT, uid);
+ r = acquire_runtime_dir_size(&runtime_dir_size);
+ if (r < 0)
+ return r;
- assert_se(gather_configuration(&runtime_dir_size) == 0);
+ xsprintf(runtime_path, "/run/user/" UID_FMT, uid);
#else
static int do_mount(const char *runtime_path, size_t runtime_dir_size, uid_t uid, gid_t gid) {
#endif // 0