Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Startup Init Lite
提交
58f42481
S
Startup Init Lite
项目概览
OpenHarmony
/
Startup Init Lite
1 年多 前同步成功
通知
3
Star
37
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
Startup Init Lite
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
58f42481
编写于
7月 31, 2021
作者:
O
openharmony_ci
提交者:
Gitee
7月 31, 2021
浏览文件
操作
浏览文件
下载
差异文件
!75 静态检查修改
Merge pull request !75 from 熊磊/init07302
上级
f41476fe
35faaff6
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
13 addition
and
4 deletion
+13
-4
interfaces/innerkits/socket/BUILD.gn
interfaces/innerkits/socket/BUILD.gn
+2
-0
interfaces/innerkits/socket/init_socket.c
interfaces/innerkits/socket/init_socket.c
+7
-2
services/param/manager/param_manager.c
services/param/manager/param_manager.c
+4
-2
未找到文件。
interfaces/innerkits/socket/BUILD.gn
浏览文件 @
58f42481
...
...
@@ -20,9 +20,11 @@ ohos_static_library("libsocket") {
include_dirs = [
"//base/startup/init_lite/interfaces/innerkits/include",
"//base/startup/init_lite/services/log",
"//third_party/bounds_checking_function/include",
]
deps = [
"//base/startup/init_lite/services/log:init_log",
"//third_party/bounds_checking_function:libsec_static",
]
}
interfaces/innerkits/socket/init_socket.c
浏览文件 @
58f42481
...
...
@@ -28,6 +28,7 @@
#include <sys/uio.h>
#include <sys/un.h>
#include "init_log.h"
#include "securec.h"
#define N_DEC 10
#define MAX_SOCKET_ENV_PREFIX_LEN 64
...
...
@@ -63,7 +64,9 @@ int GetControlSocket(const char *name)
return
-
1
;
}
char
path
[
MAX_SOCKET_ENV_PREFIX_LEN
]
=
{
0
};
snprintf
(
path
,
sizeof
(
path
),
OHOS_SOCKET_ENV_PREFIX
"%s"
,
name
);
if
(
snprintf_s
(
path
,
sizeof
(
path
),
sizeof
(
path
)
-
1
,
OHOS_SOCKET_ENV_PREFIX
"%s"
,
name
)
==
-
1
)
{
return
-
1
;
}
INIT_LOGI
(
"GetControlSocket path is %s "
,
path
);
int
fd
=
GetControlFromEnv
(
path
);
if
(
fd
<
0
)
{
...
...
@@ -78,7 +81,9 @@ int GetControlSocket(const char *name)
return
-
1
;
}
char
sockDir
[
MAX_SOCKET_DIR_LEN
]
=
{
0
};
snprintf
(
sockDir
,
sizeof
(
sockDir
),
OHOS_SOCKET_DIR
"/%s"
,
name
);
if
(
snprintf_s
(
sockDir
,
sizeof
(
sockDir
),
sizeof
(
sockDir
)
-
1
,
OHOS_SOCKET_DIR
"/%s"
,
name
)
==
-
1
)
{
return
-
1
;
}
INIT_LOGI
(
"sockDir %s "
,
sockDir
);
INIT_LOGI
(
"addr.sun_path %s "
,
addr
.
sun_path
);
if
(
strncmp
(
sockDir
,
addr
.
sun_path
,
strlen
(
sockDir
))
==
0
)
{
...
...
services/param/manager/param_manager.c
浏览文件 @
58f42481
...
...
@@ -36,8 +36,10 @@ static int SelinuxAuditCallback(void *data,
PARAM_CHECK
(
auditData
!=
NULL
,
return
PARAM_CODE_INVALID_PARAM
,
"Invalid param"
);
PARAM_CHECK
(
auditData
->
name
!=
NULL
,
return
PARAM_CODE_INVALID_PARAM
,
"Invalid param"
);
PARAM_CHECK
(
auditData
->
cr
!=
NULL
,
return
PARAM_CODE_INVALID_PARAM
,
"Invalid param"
);
snprintf
(
msgBuf
,
msgSize
,
"param=%s pid=%d uid=%d gid=%d"
,
auditData
->
name
,
auditData
->
cr
->
pid
,
auditData
->
cr
->
uid
,
auditData
->
cr
->
gid
);
if
(
snprintf_s
(
msgBuf
,
msgSize
,
msgSize
-
1
,
"param=%s pid=%d uid=%d gid=%d"
,
auditData
->
name
,
auditData
->
cr
->
pid
,
auditData
->
cr
->
uid
,
auditData
->
cr
->
gid
)
==
-
1
)
{
return
PARAM_CODE_INVALID_PARAM
;
}
return
0
;
}
#endif
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录