summaryrefslogtreecommitdiff
path: root/src/shared/path-lookup.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2012-09-18 17:11:12 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2012-09-18 19:53:34 +0200
commit67445f4e22ad924394acdd4fd49e6f238244a5ca (patch)
tree2f493d45b15768cffcac5eb34c7afed0514f7344 /src/shared/path-lookup.c
parente872b43c7ee51efb6bd6ca31d79e02af8cc3cb82 (diff)
core: move ManagerRunningAs to shared
Note: I did s/MANAGER/SYSTEMD/ everywhere, even though it makes the patch quite verbose. Nevertheless, keeping MANAGER prefix in some places, and SYSTEMD prefix in others would just lead to confusion down the road. Better to rip off the band-aid now.
Diffstat (limited to 'src/shared/path-lookup.c')
-rw-r--r--src/shared/path-lookup.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/shared/path-lookup.c b/src/shared/path-lookup.c
index a9c3e21d51..6e5529e0c7 100644
--- a/src/shared/path-lookup.c
+++ b/src/shared/path-lookup.c
@@ -22,6 +22,7 @@
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
+#include <string.h>
#include <unistd.h>
#include <errno.h>
@@ -31,6 +32,13 @@
#include "path-util.h"
#include "path-lookup.h"
+static const char* const systemd_running_as_table[_SYSTEMD_RUNNING_AS_MAX] = {
+ [SYSTEMD_SYSTEM] = "system",
+ [SYSTEMD_USER] = "user"
+};
+
+DEFINE_STRING_TABLE_LOOKUP(systemd_running_as, SystemdRunningAs);
+
int user_config_home(char **config_home) {
const char *e;
@@ -224,7 +232,7 @@ fail:
int lookup_paths_init(
LookupPaths *p,
- ManagerRunningAs running_as,
+ SystemdRunningAs running_as,
bool personal,
const char *generator,
const char *generator_early,
@@ -256,7 +264,7 @@ int lookup_paths_init(
* for the system stuff but avoid it for user
* stuff. */
- if (running_as == MANAGER_USER) {
+ if (running_as == SYSTEMD_USER) {
if (personal)
p->unit_path = user_dirs(generator, generator_early, generator_late);
@@ -323,7 +331,7 @@ int lookup_paths_init(
p->unit_path = NULL;
}
- if (running_as == MANAGER_SYSTEM) {
+ if (running_as == SYSTEMD_SYSTEM) {
#ifdef HAVE_SYSV_COMPAT
/* /etc/init.d/ compatibility does not matter to users */