summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/manager.c20
1 files changed, 20 insertions, 0 deletions
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,6 +2507,7 @@ 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)
@@ -2519,7 +2520,26 @@ static int create_generator_dir(Manager *m, char **generator, const char *name)
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",
+ p, strerror(-r));
+ free(p);
+ return r;
+ }
} else {
+ /* systemd --system --test */
+
p = strjoin("/tmp/systemd-", name, ".XXXXXX", NULL);
if (!p)
return log_oom();