diff options
author | Lennart Poettering <lennart@poettering.net> | 2011-04-07 21:22:41 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2011-04-07 21:22:41 +0200 |
commit | f1d19aa412b34fe025dfd48a5c79d34fdd0f9528 (patch) | |
tree | 1eb5022ac5e821f13dd77003843619c1ecefd116 /src/manager.c | |
parent | 20c03b7be2c87ef54533db849fd046d7014c36b4 (diff) |
manager: no need to use randomized generator dir when running as system manager
Diffstat (limited to 'src/manager.c')
-rw-r--r-- | src/manager.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/manager.c b/src/manager.c index 5cb3588c94..ad627fc669 100644 --- a/src/manager.c +++ b/src/manager.c @@ -2920,13 +2920,22 @@ void manager_run_generators(Manager *m) { } if (!m->generator_unit_path) { - char *p; - char system_path[] = "/run/systemd/generator-XXXXXX", - user_path[] = "/tmp/systemd-generator-XXXXXX"; + const char *p; + char user_path[] = "/tmp/systemd-generator-XXXXXX"; - if (!(p = mkdtemp(m->running_as == MANAGER_SYSTEM ? system_path : user_path))) { - log_error("Failed to generate generator directory: %m"); - goto finish; + if (m->running_as == MANAGER_SYSTEM) { + p = "/run/systemd/generator"; + + if (mkdir_p(p, 0755) < 0) { + log_error("Failed to create generator directory: %m"); + goto finish; + } + + } else { + if (!(p = mkdtemp(user_path))) { + log_error("Failed to create generator directory: %m"); + goto finish; + } } if (!(m->generator_unit_path = strdup(p))) { |