From fcc81ea3616b1108a23c0997331923d052539124 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 6 Jan 2014 07:50:26 +0400 Subject: core: --user -- move generator directories from /tmp to $XDG_RUNTIME_DIR --- src/core/manager.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src') diff --git a/src/core/manager.c b/src/core/manager.c index bbe5efa560..0e35ba5cab 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -2507,11 +2507,29 @@ static int create_generator_dir(Manager *m, char **generator, const char *name) return 0; if (m->running_as == SYSTEMD_SYSTEM && getpid() == 1) { + /* systemd --system, not running --test */ p = strappend("/run/systemd/", name); if (!p) return log_oom(); + r = mkdir_p_label(p, 0755); + if (r < 0) { + log_error("Failed to create generator directory %s: %s", + p, strerror(-r)); + free(p); + return r; + } + } else if (m->running_as == SYSTEMD_USER) { + const char *s = NULL; + + s = getenv("XDG_RUNTIME_DIR"); + if (!s) + return -EINVAL; + p = strjoin(s, "/systemd/", name, NULL); + if (!p) + return log_oom(); + r = mkdir_p_label(p, 0755); if (r < 0) { log_error("Failed to create generator directory %s: %s", @@ -2520,6 +2538,8 @@ static int create_generator_dir(Manager *m, char **generator, const char *name) return r; } } else { + /* systemd --system --test */ + p = strjoin("/tmp/systemd-", name, ".XXXXXX", NULL); if (!p) return log_oom(); -- cgit v1.2.3-54-g00ecf