From 929a282bad71a8548878f8a4c0924e066c5b8aa9 Mon Sep 17 00:00:00 2001 From: yinjiaming Date: Fri, 3 Dec 2021 01:41:48 +0000 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E8=83=8C=E6=99=AF=E3=80=91=20codex=20?= =?UTF-8?q?=E5=91=8A=E8=AD=A6=E6=B8=85=E9=9B=B6=20=E3=80=90=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=96=B9=E6=A1=88=E3=80=91=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=92=8C=E6=B7=BB=E5=8A=A0=E4=BA=86procfs=E7=9A=84=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E6=96=87=E4=BB=B6=E6=A8=A1=E5=BC=8F=E7=9A=84=E5=AE=8F?= =?UTF-8?q?=E5=AE=9A=E4=B9=89,=E5=AF=B9=E8=BF=9B=E8=A1=8C=E4=BD=8D?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E8=BF=90=E7=AE=97=E7=9A=84=E6=9C=89=E7=AC=A6?= =?UTF-8?q?=E5=8F=B7=E6=95=B0=E8=BF=9B=E8=A1=8C=E5=BC=BA=E5=88=B6=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E8=BD=AC=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【影响】 对现有的产品编译不会有影响。 re #I4KVS7 Signed-off-by: yinjiaming --- fs/proc/include/proc_fs.h | 3 +++ fs/proc/os_adapt/proc_init.c | 2 +- fs/proc/os_adapt/proc_vfs.c | 2 -- fs/proc/src/proc_file.c | 2 +- syscall/fs_syscall.c | 4 ++-- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/fs/proc/include/proc_fs.h b/fs/proc/include/proc_fs.h index ed1f6fcb..14bb5ff3 100644 --- a/fs/proc/include/proc_fs.h +++ b/fs/proc/include/proc_fs.h @@ -53,6 +53,9 @@ extern "C" { typedef unsigned short fmode_t; #define PROC_ERROR (-1) +/* Default file mode for procfs */ +#define PROCFS_DEFAULT_MODE 0550 + /* 64bit hashes as llseek() offset (for directories) */ #define FMODE_64BITHASH ((fmode_t)0x400) /* 32bit hashes as llseek() offset (for directories) */ diff --git a/fs/proc/os_adapt/proc_init.c b/fs/proc/os_adapt/proc_init.c index ec47b295..e8dc2df1 100644 --- a/fs/proc/os_adapt/proc_init.c +++ b/fs/proc/os_adapt/proc_init.c @@ -45,7 +45,7 @@ void ProcFsInit(void) { int ret; - ret = mkdir(PROCFS_MOUNT_POINT, 0); + ret = mkdir(PROCFS_MOUNT_POINT, PROCFS_DEFAULT_MODE); if (ret < 0) { PRINT_ERR("failed to mkdir %s, errno = %d\n", PROCFS_MOUNT_POINT, get_errno()); return; diff --git a/fs/proc/os_adapt/proc_vfs.c b/fs/proc/os_adapt/proc_vfs.c index 7cabbaf9..3876967c 100644 --- a/fs/proc/os_adapt/proc_vfs.c +++ b/fs/proc/os_adapt/proc_vfs.c @@ -41,8 +41,6 @@ #include "los_tables.h" #include "internal.h" -#define PROCFS_DEFAULT_MODE 0555 - #ifdef LOSCFG_FS_PROC static struct VnodeOps g_procfsVops; static struct file_operations_vfs g_procfsFops; diff --git a/fs/proc/src/proc_file.c b/fs/proc/src/proc_file.c index 331be79c..9eebcd46 100644 --- a/fs/proc/src/proc_file.c +++ b/fs/proc/src/proc_file.c @@ -49,7 +49,7 @@ static struct ProcFile g_procPf = { static struct ProcDirEntry g_procRootDirEntry = { .nameLen = 5, - .mode = S_IFDIR | S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH, + .mode = S_IFDIR | PROCFS_DEFAULT_MODE, .count = ATOMIC_INIT(1), .procFileOps = NULL, .parent = &g_procRootDirEntry, diff --git a/syscall/fs_syscall.c b/syscall/fs_syscall.c index f045b376..b0e0243f 100644 --- a/syscall/fs_syscall.c +++ b/syscall/fs_syscall.c @@ -307,7 +307,7 @@ int SysOpen(const char *path, int oflags, ...) goto ERROUT; } - if (oflags & O_CLOEXEC) { + if ((unsigned int)oflags & O_CLOEXEC) { SetCloexecFlag(procFd); } @@ -1640,7 +1640,7 @@ int SysOpenat(int dirfd, const char *path, int oflags, ...) goto ERROUT; } - if (oflags & O_CLOEXEC) { + if ((unsigned int)oflags & O_CLOEXEC) { SetCloexecFlag(procFd); } -- GitLab