diff options
author | Kay Sievers <kay@vrfy.org> | 2014-01-06 07:50:26 +0400 |
---|---|---|
committer | Kay Sievers <kay@vrfy.org> | 2014-01-07 01:35:13 +0800 |
commit | fcc81ea3616b1108a23c0997331923d052539124 (patch) | |
tree | 692a49ee8b432898d8e4bc1db4068e1d792b9399 /src | |
parent | 734624951b36a08bd275dc06c0e5f17b7c2792d9 (diff) |
core: --user -- move generator directories from /tmp to $XDG_RUNTIME_DIR
Diffstat (limited to 'src')
-rw-r--r-- | src/core/manager.c | 20 |
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(); |