summaryrefslogtreecommitdiff
path: root/src/shared/path-lookup.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2017-11-23 17:45:58 +0100
committerLennart Poettering <lennart@poettering.net>2017-11-29 12:34:12 +0100
commit45639f1be5f5aeea3c468abe69e38f68d52e39ee (patch)
tree374c13cb9c82712a798bf6f41dd8883aa8cf7965 /src/shared/path-lookup.c
parent45a7b16bae0dbda31caa54c608e72428cacdb6f4 (diff)
downloadsystemd-45639f1be5f5aeea3c468abe69e38f68d52e39ee.tar.gz
core: never remove "transient" and "control" directories from unit search path
This changes the unit search path logic to never drop the transient and control directories from the unit search path. This is necessary as we add new entries to both during runtime, due to the "systemctl set-property" and transient unit logic. Previously, the "transient" directory was created during early boot to deal with this, but the "control" directories were not covered like that. Creating the control directories early at boot is not possible however, as /etc might be read-only then, and we do define a persistent control directory. Hence, let's create these dirs on-demand when we need them, and make sure the search path clean-up logic never drops them from the search path even if they are initially missing. (Also, always create these paths properly labelled)
Diffstat (limited to 'src/shared/path-lookup.c')
-rw-r--r--src/shared/path-lookup.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/shared/path-lookup.c b/src/shared/path-lookup.c
index b40887bfbd..57e0757529 100644
--- a/src/shared/path-lookup.c
+++ b/src/shared/path-lookup.c
@@ -736,6 +736,14 @@ int lookup_paths_reduce(LookupPaths *p) {
struct stat st;
unsigned k;
+ /* Never strip the transient and control directories from the path */
+ if (path_equal_ptr(p->search_path[c], p->transient) ||
+ path_equal_ptr(p->search_path[c], p->persistent_control) ||
+ path_equal_ptr(p->search_path[c], p->runtime_control)) {
+ c++;
+ continue;
+ }
+
if (p->root_dir)
r = lstat(p->search_path[c], &st);
else