execute: also do the private/ symlink dance when runtime dir preservation is requested
authorLennart Poettering <lennart@poettering.net>
Thu, 14 Mar 2019 16:00:35 +0000 (17:00 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 19 Mar 2019 15:52:28 +0000 (16:52 +0100)
In that case it's not safe to leave a regular dir around, hence, move it
to private/ too.

src/core/execute.c

index e7be6c4..0fe084f 100644 (file)
@@ -2085,7 +2085,8 @@ static int setup_exec_directory(
                         goto fail;
 
                 if (context->dynamic_user &&
-                    !IN_SET(type, EXEC_DIRECTORY_RUNTIME, EXEC_DIRECTORY_CONFIGURATION)) {
+                    (!IN_SET(type, EXEC_DIRECTORY_RUNTIME, EXEC_DIRECTORY_CONFIGURATION) ||
+                     (type == EXEC_DIRECTORY_RUNTIME && context->runtime_directory_preserve_mode != EXEC_PRESERVE_NO))) {
                         _cleanup_free_ char *private_root = NULL;
 
                         /* So, here's one extra complication when dealing with DynamicUser=1 units. In that case we