diff options
-rw-r--r-- | man/tmpfiles.d.xml | 6 | ||||
-rw-r--r-- | src/tmpfiles/tmpfiles.c | 16 |
2 files changed, 21 insertions, 1 deletions
diff --git a/man/tmpfiles.d.xml b/man/tmpfiles.d.xml index 76cae39aae..5d8c2b5b32 100644 --- a/man/tmpfiles.d.xml +++ b/man/tmpfiles.d.xml @@ -109,7 +109,11 @@ of the directories they reside in. If multiple files specify the same path, the entry in the file with the lexicographically earliest name will be applied, all - all other conflicting entries logged as errors.</para> + all other conflicting entries will be logged as + errors. When two lines are prefix and suffix of each + other, then the prefix is always processed first, the + suffix later. Otherwise the files/directories are + processed in the order they are listed.</para> <para>If the administrator wants to disable a configuration file supplied by the vendor, the diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index d68693f829..c6121bccf3 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c @@ -101,6 +101,8 @@ typedef struct Item { bool age_set:1; bool keep_first_level:1; + + bool done:1; } Item; static bool arg_create = false; @@ -977,9 +979,23 @@ static int clean_item(Item *i) { static int process_item(Item *i) { int r, q, p; + char prefix[PATH_MAX]; assert(i); + if (i->done) + return 0; + + i->done = true; + + PATH_FOREACH_PREFIX(prefix, i->path) { + Item *j; + + j = hashmap_get(items, prefix); + if (j) + process_item(j); + } + r = arg_create ? create_item(i) : 0; q = arg_remove ? remove_item(i) : 0; p = arg_clean ? clean_item(i) : 0; |