]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/core/execute.c
Fixes #11128
[thirdparty/systemd.git] / src / core / execute.c
index 07c5a72721b58da24edb3dc6a89b9c370d96032c..092c80a6e7c87561b99a625f6c28489698900dc5 100644 (file)
@@ -2160,8 +2160,14 @@ static int setup_exec_directory(
                         r = mkdir_label(p, context->directories[type].mode);
                         if (r < 0 && r != -EEXIST)
                                 goto fail;
-                        if (r == -EEXIST && !context->dynamic_user)
-                                continue;
+                        if (r == -EEXIST) {
+                                if (chmod(p, context->directories[type].mode) < 0) {
+                                        r = -errno;
+                                        goto fail;
+                                }
+                                if (!context->dynamic_user)
+                                        continue;
+                        }
                 }
 
                 /* Don't change the owner of the configuration directory, as in the common case it is not written to by