Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Startup Init Lite
提交
c8b1b89f
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c8b1b89f
编写于
9月 13, 2021
作者:
S
sun_fan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
init: fix param
Signed-off-by:
N
sun_fan
<
sun_fan1@hoperun.com
>
上级
b06d198c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
29 addition
and
27 deletion
+29
-27
services/param/watcher/proxy/watcher_manager.cpp
services/param/watcher/proxy/watcher_manager.cpp
+2
-2
services/src/init_cmds.c
services/src/init_cmds.c
+26
-20
services/src/init_reboot.c
services/src/init_reboot.c
+1
-5
未找到文件。
services/param/watcher/proxy/watcher_manager.cpp
浏览文件 @
c8b1b89f
...
@@ -221,9 +221,9 @@ void WatcherManager::RunLoop()
...
@@ -221,9 +221,9 @@ void WatcherManager::RunLoop()
continue
;
continue
;
}
}
fd
=
GetServerFd
(
true
);
fd
=
GetServerFd
(
true
);
PARAM_LOGE
(
"Failed to recv msg from server
%d errno %d"
,
recvLen
,
errno
);
PARAM_LOGE
(
"Failed to recv msg from server
errno %d"
,
errno
);
}
}
PARAM_LOGD
(
"Recv msg from server
%d"
,
recvLen
);
PARAM_LOGD
(
"Recv msg from server
"
);
if
(
recvLen
>=
(
ssize_t
)
sizeof
(
ParamMessage
))
{
if
(
recvLen
>=
(
ssize_t
)
sizeof
(
ParamMessage
))
{
ProcessWatcherMessage
(
buffer
,
recvLen
);
ProcessWatcherMessage
(
buffer
,
recvLen
);
}
}
...
...
services/src/init_cmds.c
浏览文件 @
c8b1b89f
...
@@ -484,6 +484,27 @@ static void DoChown(const char *cmdContent, int maxArg)
...
@@ -484,6 +484,27 @@ static void DoChown(const char *cmdContent, int maxArg)
return
;
return
;
}
}
static
int
DoPathChown
(
const
char
*
path
,
const
char
*
uid
,
const
char
*
gid
)
{
if
(
path
==
NULL
||
uid
==
NULL
||
gid
==
NULL
)
{
return
-
1
;
}
uid_t
user
=
DecodeUid
(
uid
);
gid_t
group
=
DecodeUid
(
gid
);
if
(
user
==
(
uid_t
)
-
1
||
group
==
(
uid_t
)
-
1
)
{
INIT_LOGE
(
"Change path owner with invalid user/group"
);
return
-
1
;
}
int
rc
=
chown
(
path
,
user
,
group
);
if
(
rc
<
0
)
{
INIT_LOGE
(
"Change path
\"
%s
\"
ower to user: %s group: %s failed"
,
path
,
uid
,
gid
);
return
-
1
;
}
return
0
;
}
static
void
DoMkDir
(
const
char
*
cmdContent
,
int
maxArg
)
static
void
DoMkDir
(
const
char
*
cmdContent
,
int
maxArg
)
{
{
// mkdir support format:
// mkdir support format:
...
@@ -513,26 +534,11 @@ static void DoMkDir(const char *cmdContent, int maxArg)
...
@@ -513,26 +534,11 @@ static void DoMkDir(const char *cmdContent, int maxArg)
INIT_LOGE
(
"Change path
\"
%s
\"
mode to %04o failed"
,
ctx
->
argv
[
0
],
mode
);
INIT_LOGE
(
"Change path
\"
%s
\"
mode to %04o failed"
,
ctx
->
argv
[
0
],
mode
);
break
;
break
;
}
}
if
(
ctx
->
argv
[
++
index
]
!=
NULL
)
{
// mkdir with user and group
index
=
index
+
1
;
if
(
ctx
->
argv
[
index
+
1
]
!=
NULL
)
{
if
((
ctx
->
argv
[
index
]
!=
NULL
)
&&
(
ctx
->
argv
[
index
+
1
]
!=
NULL
))
{
uid_t
user
=
DecodeUid
(
ctx
->
argv
[
index
]);
rc
=
DoPathChown
(
ctx
->
argv
[
0
],
ctx
->
argv
[
index
],
ctx
->
argv
[
index
+
1
]);
gid_t
group
=
DecodeUid
(
ctx
->
argv
[
index
+
1
]);
}
else
{
if
(
user
==
(
uid_t
)
-
1
||
group
==
(
uid_t
)
-
1
)
{
rc
=
-
1
;
INIT_LOGE
(
"Change path owner with invalid user/group"
);
rc
=
-
1
;
break
;
}
rc
=
chown
(
ctx
->
argv
[
0
],
user
,
group
);
if
(
rc
<
0
)
{
INIT_LOGE
(
"Change path
\"
%s
\"
ower to user: %s group: %s failed"
,
ctx
->
argv
[
0
],
ctx
->
argv
[
index
],
ctx
->
argv
[
index
+
1
]);
break
;
}
}
else
{
rc
=
-
1
;
// Miss group
break
;
}
}
}
}
}
if
(
rc
<
0
)
{
if
(
rc
<
0
)
{
...
...
services/src/init_reboot.c
浏览文件 @
c8b1b89f
...
@@ -185,7 +185,6 @@ void DoReboot(const char *value)
...
@@ -185,7 +185,6 @@ void DoReboot(const char *value)
return
;
return
;
}
}
}
}
StopAllServicesBeforeReboot
();
StopAllServicesBeforeReboot
();
sync
();
sync
();
if
(
GetMountStatusForMountPoint
(
"/vendor"
)
!=
0
&&
umount
(
"/vendor"
)
!=
0
)
{
if
(
GetMountStatusForMountPoint
(
"/vendor"
)
!=
0
&&
umount
(
"/vendor"
)
!=
0
)
{
...
@@ -194,9 +193,6 @@ void DoReboot(const char *value)
...
@@ -194,9 +193,6 @@ void DoReboot(const char *value)
if
(
GetMountStatusForMountPoint
(
"/data"
)
!=
0
&&
umount
(
"/data"
)
!=
0
)
{
if
(
GetMountStatusForMountPoint
(
"/data"
)
!=
0
&&
umount
(
"/data"
)
!=
0
)
{
INIT_LOGE
(
"DoReboot umount data failed! errno = %d."
,
errno
);
INIT_LOGE
(
"DoReboot umount data failed! errno = %d."
,
errno
);
}
}
INIT_LOGI
(
"DoReboot value = %s valueData %s"
,
value
,
valueData
);
// "shutdown"
int
ret
=
0
;
int
ret
=
0
;
if
(
valueData
==
NULL
)
{
if
(
valueData
==
NULL
)
{
ret
=
reboot
(
RB_AUTOBOOT
);
ret
=
reboot
(
RB_AUTOBOOT
);
...
@@ -209,6 +205,6 @@ void DoReboot(const char *value)
...
@@ -209,6 +205,6 @@ void DoReboot(const char *value)
}
else
if
(
strncmp
(
valueData
,
"flashing"
,
strlen
(
"flashing"
))
==
0
)
{
}
else
if
(
strncmp
(
valueData
,
"flashing"
,
strlen
(
"flashing"
))
==
0
)
{
ret
=
CheckAndRebootToUpdater
(
valueData
,
"flashing"
,
"flashing:"
,
"boot_flashing"
);
ret
=
CheckAndRebootToUpdater
(
valueData
,
"flashing"
,
"flashing:"
,
"boot_flashing"
);
}
}
INIT_LOG
E
(
"DoReboot value = %s %s."
,
value
,
(
ret
==
0
)
?
"success"
:
"fail"
);
INIT_LOG
I
(
"DoReboot value = %s %s."
,
value
,
(
ret
==
0
)
?
"success"
:
"fail"
);
return
;
return
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录