summaryrefslogtreecommitdiff
path: root/src/shared/install.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-02-24 21:43:09 +0100
committerLennart Poettering <lennart@poettering.net>2016-04-12 13:43:30 +0200
commit385eb996344f3b2a9223b66e83b853c844c02947 (patch)
tree1f608dfbc4303241b5e559137d6b94778c9d7d39 /src/shared/install.c
parent21b3926840b22c738a5e575f089485732e1cbd28 (diff)
install: be more accurate when checking whether something is runtime configuration
Let's actually check the runtime config dir, instead of just /run.
Diffstat (limited to 'src/shared/install.c')
-rw-r--r--src/shared/install.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/shared/install.c b/src/shared/install.c
index f802343399..59582e573d 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -118,6 +118,22 @@ static int path_is_config(const LookupPaths *p, const char *path) {
path_equal(parent, p->runtime_config);
}
+static int path_is_runtime(const LookupPaths *p, const char *path) {
+ _cleanup_free_ char *parent = NULL;
+
+ assert(p);
+ assert(path);
+
+ if (path_startswith(path, "/run"))
+ return true;
+
+ parent = dirname_malloc(path);
+ if (!parent)
+ return -ENOMEM;
+
+ return path_equal(parent, p->runtime_config);
+}
+
static int verify_root_dir(UnitFileScope scope, const char **root_dir) {
int r;
@@ -1950,7 +1966,11 @@ int unit_file_lookup_state(
switch (i->type) {
case UNIT_FILE_TYPE_MASKED:
- state = path_startswith(i->path, "/run") ? UNIT_FILE_MASKED_RUNTIME : UNIT_FILE_MASKED;
+ r = path_is_runtime(paths, i->path);
+ if (r < 0)
+ return r;
+
+ state = r > 0 ? UNIT_FILE_MASKED_RUNTIME : UNIT_FILE_MASKED;
break;
case UNIT_FILE_TYPE_REGULAR: