Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Startup Init Lite
提交
30ee2067
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看板
未验证
提交
30ee2067
编写于
3月 25, 2022
作者:
O
openharmony_ci
提交者:
Gitee
3月 25, 2022
浏览文件
操作
浏览文件
下载
差异文件
!454 fix: 修复代码静态检查(0324)
Merge pull request !454 from 熊磊/init0324xyt
上级
40040e72
b1b6a655
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
27 addition
and
21 deletion
+27
-21
interfaces/innerkits/sandbox/sandbox.c
interfaces/innerkits/sandbox/sandbox.c
+1
-1
services/begetctl/misc_daemon.cpp
services/begetctl/misc_daemon.cpp
+3
-3
services/init/init_common_service.c
services/init/init_common_service.c
+1
-1
services/init/init_group_manager.c
services/init/init_group_manager.c
+2
-1
services/init/standard/fd_holder_service.c
services/init/standard/fd_holder_service.c
+1
-1
services/param/manager/param_manager.c
services/param/manager/param_manager.c
+5
-3
services/param/manager/param_utils.c
services/param/manager/param_utils.c
+2
-1
services/param/trigger/trigger_checker.c
services/param/trigger/trigger_checker.c
+4
-2
services/param/trigger/trigger_manager.c
services/param/trigger/trigger_manager.c
+4
-2
services/param/watcher/agent/watcher_manager_kits.cpp
services/param/watcher/agent/watcher_manager_kits.cpp
+2
-2
services/utils/init_utils.c
services/utils/init_utils.c
+2
-1
ueventd/ueventd_read_cfg.c
ueventd/ueventd_read_cfg.c
+0
-3
未找到文件。
interfaces/innerkits/sandbox/sandbox.c
浏览文件 @
30ee2067
...
...
@@ -298,7 +298,7 @@ static void InitSandbox(sandbox_t *sandbox, const char *sandboxConfig, const cha
return
;
}
if
(
sandbox
->
isCreated
)
{
BEGET_LOGE
(
"Sandbox %s has created."
);
BEGET_LOGE
(
"Sandbox %s has created."
,
name
);
return
;
}
if
(
UnshareNamespace
(
CLONE_NEWNS
)
<
0
)
{
...
...
services/begetctl/misc_daemon.cpp
浏览文件 @
30ee2067
...
...
@@ -81,13 +81,13 @@ static void WriteLogoContent(int fd, const std::string &logoPath, uint32_t size)
(
void
)
fclose
(
rgbFile
);
return
;
}
uint32_t
ret
=
fread
(
buffer
,
1
,
size
,
rgbFile
);
if
(
ret
<
0
)
{
(
void
)
fread
(
buffer
,
1
,
size
,
rgbFile
);
if
(
ferror
(
rgbFile
)
)
{
(
void
)
fclose
(
rgbFile
);
free
(
buffer
);
return
;
}
ret
=
write
(
fd
,
buffer
,
size
);
uint32_t
ret
=
write
(
fd
,
buffer
,
size
);
if
(
ret
!=
size
)
{
(
void
)
fclose
(
rgbFile
);
free
(
buffer
);
...
...
services/init/init_common_service.c
浏览文件 @
30ee2067
...
...
@@ -573,7 +573,7 @@ static void ServiceTimerStartProcess(const TimerHandle handler, void *context)
ServiceStopTimer
(
service
);
int
ret
=
ServiceStart
(
service
);
if
(
ret
!=
SERVICE_SUCCESS
)
{
INIT_LOGE
(
"Start service
\'
%s
\'
in timer failed"
);
INIT_LOGE
(
"Start service
\'
%s
\'
in timer failed"
,
service
->
name
);
}
}
...
...
services/init/init_group_manager.c
浏览文件 @
30ee2067
...
...
@@ -24,7 +24,8 @@ static InitWorkspace g_initWorkspace = {0, 0, {0}, {0}, {0}};
int
GenerateHashCode
(
const
char
*
key
)
{
int
code
=
0
;
for
(
size_t
i
=
0
;
i
<
strlen
(
key
);
i
++
)
{
size_t
keyLen
=
strlen
(
key
);
for
(
size_t
i
=
0
;
i
<
keyLen
;
i
++
)
{
code
+=
key
[
i
]
-
'A'
;
}
return
code
;
...
...
services/init/standard/fd_holder_service.c
浏览文件 @
30ee2067
...
...
@@ -142,7 +142,7 @@ static void HandlerGetFds(int sock, Service *service)
}
if
(
service
->
fds
==
NULL
||
service
->
fdCount
==
0
)
{
INIT_LOGE
(
"Service
\'
%s
\'
does not have any held fds"
);
INIT_LOGE
(
"Service
\'
%s
\'
does not have any held fds"
,
service
->
name
);
errorInfo
=
"Service without any fds"
;
}
...
...
services/param/manager/param_manager.c
浏览文件 @
30ee2067
...
...
@@ -242,10 +242,12 @@ static int CheckParamPermissionWithSelinux(const ParamSecurityLabel *srcLabel, c
{
static
void
(
*
setSelinuxLogCallback
)();
static
int
(
*
setParamCheck
)(
const
char
*
paraName
,
struct
ucred
*
uc
);
g_selinuxHandle
=
dlopen
(
"/system/lib/libparaperm_checker.z.so"
,
RTLD_LAZY
);
if
(
g_selinuxHandle
==
NULL
)
{
PARAM_LOGE
(
"Failed to dlopen libparaperm_checker.z.so, %s
\n
"
,
dlerror
());
return
DAC_RESULT_FORBIDED
;
g_selinuxHandle
=
dlopen
(
"/system/lib/libparaperm_checker.z.so"
,
RTLD_LAZY
);
if
(
g_selinuxHandle
==
NULL
)
{
PARAM_LOGE
(
"Failed to dlopen libparaperm_checker.z.so, %s
\n
"
,
dlerror
());
return
DAC_RESULT_FORBIDED
;
}
}
if
(
setSelinuxLogCallback
==
NULL
)
{
setSelinuxLogCallback
=
(
void
(
*
)())
dlsym
(
g_selinuxHandle
,
"SetSelinuxLogCallback"
);
...
...
services/param/manager/param_utils.c
浏览文件 @
30ee2067
...
...
@@ -60,8 +60,9 @@ int GetSubStringInfo(const char *buff, uint32_t buffLen, char delimiter, SubStri
{
PARAM_CHECK
(
buff
!=
NULL
&&
info
!=
NULL
,
return
0
,
"Invalid buff"
);
size_t
i
=
0
;
size_t
buffStrLen
=
strlen
(
buff
);
// 去掉开始的空格
for
(;
i
<
strlen
(
buff
)
;
i
++
)
{
for
(;
i
<
buffStrLen
;
i
++
)
{
if
(
!
isspace
(
buff
[
i
]))
{
break
;
}
...
...
services/param/trigger/trigger_checker.c
浏览文件 @
30ee2067
...
...
@@ -220,11 +220,12 @@ int ComputeCondition(LogicCalculator *calculator, const char *condition)
PARAM_CHECK
(
calculator
!=
NULL
&&
condition
!=
NULL
,
return
-
1
,
"Invalid calculator"
);
uint32_t
currIndex
=
0
;
uint32_t
start
=
0
;
size_t
conditionLen
=
strlen
(
condition
);
int
noneOper
=
1
;
CalculatorClear
(
calculator
);
LogicData
data1
=
{};
LogicData
data2
=
{};
while
(
currIndex
<
strlen
(
condition
)
)
{
while
(
currIndex
<
conditionLen
)
{
if
(
condition
[
currIndex
]
==
'|'
||
condition
[
currIndex
]
==
'&'
)
{
noneOper
=
0
;
int
ret
=
CalculatorPop
(
calculator
,
(
void
*
)
&
data2
);
...
...
@@ -274,10 +275,11 @@ int ConvertInfixToPrefix(const char *condition, char *prefix, uint32_t prefixLen
int
ret
;
uint32_t
curr
=
0
;
uint32_t
prefixIndex
=
0
;
size_t
conditionLen
=
strlen
(
condition
);
LogicCalculator
calculator
;
CalculatorInit
(
&
calculator
,
MAX_CALC_PARAM
,
1
,
0
);
while
(
curr
<
strlen
(
condition
)
)
{
while
(
curr
<
conditionLen
)
{
if
(
condition
[
curr
]
==
')'
)
{
CalculatorPopChar
(
&
calculator
,
&
e
);
while
(
e
!=
'('
)
{
...
...
services/param/trigger/trigger_manager.c
浏览文件 @
30ee2067
...
...
@@ -595,7 +595,8 @@ static int JobNodeGetNodeHasCode(const HashNode *node)
{
JobNode
*
jobNode
=
HASHMAP_ENTRY
(
node
,
JobNode
,
hashNode
);
int
code
=
0
;
for
(
size_t
i
=
0
;
i
<
strlen
(
jobNode
->
name
);
i
++
)
{
size_t
nameLen
=
strlen
(
jobNode
->
name
);
for
(
size_t
i
=
0
;
i
<
nameLen
;
i
++
)
{
code
+=
jobNode
->
name
[
i
]
-
'A'
;
}
return
code
;
...
...
@@ -605,7 +606,8 @@ static int JobNodeGetKeyHasCode(const void *key)
{
int
code
=
0
;
const
char
*
buff
=
(
char
*
)
key
;
for
(
size_t
i
=
0
;
i
<
strlen
(
buff
);
i
++
)
{
size_t
buffLen
=
strlen
(
buff
);
for
(
size_t
i
=
0
;
i
<
buffLen
;
i
++
)
{
code
+=
buff
[
i
]
-
'A'
;
}
return
code
;
...
...
services/param/watcher/agent/watcher_manager_kits.cpp
浏览文件 @
30ee2067
...
...
@@ -135,9 +135,9 @@ int32_t WatcherManagerKits::AddWatcher(const std::string &keyPrefix, ParameterCh
watcher
=
new
ParamWatcher
(
keyPrefix
,
callback
,
context
);
WATCHER_CHECK
(
watcher
!=
nullptr
,
return
-
1
,
"Failed to create watcher for %s"
,
keyPrefix
.
c_str
());
auto
watcherManager
=
GetService
();
WATCHER_CHECK
(
watcherManager
!=
nullptr
,
return
-
1
,
"Failed to get watcher manager"
);
WATCHER_CHECK
(
watcherManager
!=
nullptr
,
delete
watcher
;
return
-
1
,
"Failed to get watcher manager"
);
uint32_t
watcherId
=
watcherManager
->
AddWatcher
(
keyPrefix
,
watcher
);
WATCHER_CHECK
(
watcherId
!=
0
,
return
-
1
,
"Failed to add watcher for %s"
,
keyPrefix
.
c_str
());
WATCHER_CHECK
(
watcherId
!=
0
,
delete
watcher
;
return
-
1
,
"Failed to add watcher for %s"
,
keyPrefix
.
c_str
());
watcher
->
SetWatcherId
(
watcherId
);
SetParamWatcher
(
keyPrefix
,
watcher
);
return
watcher
->
GetWatcherId
();
...
...
services/utils/init_utils.c
浏览文件 @
30ee2067
...
...
@@ -58,7 +58,8 @@ uid_t DecodeUid(const char *name)
{
INIT_CHECK_RETURN_VALUE
(
name
!=
NULL
,
-
1
);
int
digitFlag
=
1
;
for
(
unsigned
int
i
=
0
;
i
<
strlen
(
name
);
++
i
)
{
size_t
nameLen
=
strlen
(
name
);
for
(
unsigned
int
i
=
0
;
i
<
nameLen
;
++
i
)
{
if
(
isalpha
(
name
[
i
]))
{
digitFlag
=
0
;
break
;
...
...
ueventd/ueventd_read_cfg.c
浏览文件 @
30ee2067
...
...
@@ -216,9 +216,6 @@ int ParseUeventConfig(char *buffer)
static
void
DoUeventConfigParse
(
char
*
buffer
,
size_t
length
)
{
if
(
length
<
0
)
{
return
;
}
char
**
items
=
NULL
;
int
count
=
-
1
;
const
int
maxItemCount
=
DEFAULTITEMCOUNT
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录