From eb46344fd8b7d42e6268353bfc801a1a9c8cb9a3 Mon Sep 17 00:00:00 2001
From: songbuhuang <544824346@qq.com>
Date: Thu, 9 Mar 2023 19:38:09 +0800
Subject: [PATCH 27/46] modifying cpurt file permissions

Signed-off-by: songbuhuang <544824346@qq.com>
---
 src/common/constants.h                       | 4 ++++
 src/daemon/common/sysinfo.c                  | 3 +--
 src/daemon/executor/container_cb/execution.c | 3 ++-
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/common/constants.h b/src/common/constants.h
index 93a069de..1a4cb7c4 100644
--- a/src/common/constants.h
+++ b/src/common/constants.h
@@ -22,6 +22,10 @@ extern "C" {
 
 /* mode of file and directory */
 
+#define DEFAULT_CGROUP_FILE_MODE 0644
+
+#define DEFAULT_CGROUP_DIR_MODE 0755
+
 #define DEFAULT_SECURE_FILE_MODE 0640
 
 #define DEFAULT_SECURE_DIRECTORY_MODE 0750
diff --git a/src/daemon/common/sysinfo.c b/src/daemon/common/sysinfo.c
index 8ad92b2a..cb02bee3 100644
--- a/src/daemon/common/sysinfo.c
+++ b/src/daemon/common/sysinfo.c
@@ -24,6 +24,7 @@
 #include <linux/magic.h>
 #include <sys/stat.h>
 
+#include "constants.h"
 #include "err_msg.h"
 #include "isula_libutils/log.h"
 #include "utils.h"
@@ -71,8 +72,6 @@
 
 #define CGROUP_MOUNTPOINT "/sys/fs/cgroup"
 #define CGROUP_ISULAD_PATH CGROUP_MOUNTPOINT"/isulad"
-#define DEFAULT_CGROUP_DIR_MODE 0755
-#define DEFAULT_CGROUP_FILE_MODE 0644
 #define CGROUP2_CONTROLLERS_PATH CGROUP_MOUNTPOINT"/cgroup.controllers"
 #define CGROUP2_SUBTREE_CONTROLLER_PATH CGROUP_MOUNTPOINT"/cgroup.subtree_control"
 #define CGROUP2_CPUSET_CPUS_EFFECTIVE_PATH CGROUP_MOUNTPOINT"/cpuset.cpus.effective"
diff --git a/src/daemon/executor/container_cb/execution.c b/src/daemon/executor/container_cb/execution.c
index 92c34b09..130bdaa4 100644
--- a/src/daemon/executor/container_cb/execution.c
+++ b/src/daemon/executor/container_cb/execution.c
@@ -46,6 +46,7 @@
 #include "isulad_config.h"
 #include "specs_api.h"
 #include "container_api.h"
+#include "constants.h"
 #include "execution_extend.h"
 #include "execution_information.h"
 #include "execution_stream.h"
@@ -318,7 +319,7 @@ static int maybe_create_cpu_realtime_file(int64_t value, const char *file, const
         return 0;
     }
 
-    ret = util_mkdir_p(path, CONFIG_DIRECTORY_MODE);
+    ret = util_mkdir_p(path, DEFAULT_CGROUP_DIR_MODE);
     if (ret != 0) {
         ERROR("Failed to mkdir: %s", path);
         return -1;
-- 
2.25.1

