]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Merge pull request #11540 from taro-yamada/mytest
authorLennart Poettering <lennart@poettering.net>
Tue, 29 Jan 2019 10:27:42 +0000 (11:27 +0100)
committerGitHub <noreply@github.com>
Tue, 29 Jan 2019 10:27:42 +0000 (11:27 +0100)
ReFix #11128

src/core/execute.c

index 092c80a6e7c87561b99a625f6c28489698900dc5..a7082310ba6a890921bd7803751a17150107b591 100644 (file)
@@ -2161,10 +2161,17 @@ static int setup_exec_directory(
                         if (r < 0 && r != -EEXIST)
                                 goto fail;
                         if (r == -EEXIST) {
-                                if (chmod(p, context->directories[type].mode) < 0) {
+                                struct stat st;
+
+                                if (stat(p, &st) < 0) {
                                         r = -errno;
                                         goto fail;
                                 }
+                                if (((st.st_mode ^ context->directories[type].mode) & 07777) != 0)
+                                        log_warning("%s \'%s\' already exists but the mode is different. "
+                                                    "(filesystem: %o %sMode: %o)",
+                                                    exec_directory_type_to_string(type), *rt,
+                                                    st.st_mode & 07777, exec_directory_type_to_string(type), context->directories[type].mode & 07777);
                                 if (!context->dynamic_user)
                                         continue;
                         }