Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Startup Init Lite
提交
2ba89831
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,发现更多精彩内容 >>
You need to sign in or sign up before continuing.
提交
2ba89831
编写于
11月 16, 2021
作者:
X
xionglei6
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
init: fix bugs
Signed-off-by:
N
xionglei6
<
xionglei6@huawei.com
>
上级
59b51bd1
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
22 addition
and
7 deletion
+22
-7
interfaces/innerkits/socket/BUILD.gn
interfaces/innerkits/socket/BUILD.gn
+4
-1
services/init/standard/init_reboot.c
services/init/standard/init_reboot.c
+3
-0
services/param/adapter/param_persistadp.c
services/param/adapter/param_persistadp.c
+15
-6
未找到文件。
interfaces/innerkits/socket/BUILD.gn
浏览文件 @
2ba89831
...
@@ -35,5 +35,8 @@ ohos_shared_library("libsocket") {
...
@@ -35,5 +35,8 @@ ohos_shared_library("libsocket") {
include_dirs = service_socket_include
include_dirs = service_socket_include
deps = service_socket_deps
deps = service_socket_deps
part_name = "init"
part_name = "init"
install_images = [ "system" ]
install_images = [
"system",
"updater",
]
}
}
services/init/standard/init_reboot.c
浏览文件 @
2ba89831
...
@@ -116,6 +116,9 @@ static int CheckAndRebootToUpdater(const char *valueData, const char *cmd, const
...
@@ -116,6 +116,9 @@ static int CheckAndRebootToUpdater(const char *valueData, const char *cmd, const
ret
=
snprintf_s
(
msg
.
update
,
MAX_UPDATE_SIZE
,
MAX_UPDATE_SIZE
-
1
,
"%s"
,
p
);
ret
=
snprintf_s
(
msg
.
update
,
MAX_UPDATE_SIZE
,
MAX_UPDATE_SIZE
-
1
,
"%s"
,
p
);
INIT_ERROR_CHECK
(
ret
>
0
,
return
-
1
,
"Failed to format param for %s."
,
cmd
);
INIT_ERROR_CHECK
(
ret
>
0
,
return
-
1
,
"Failed to format param for %s."
,
cmd
);
msg
.
update
[
MAX_UPDATE_SIZE
-
1
]
=
0
;
msg
.
update
[
MAX_UPDATE_SIZE
-
1
]
=
0
;
}
else
{
ret
=
memset_s
(
msg
.
update
,
MAX_UPDATE_SIZE
,
0
,
MAX_UPDATE_SIZE
);
INIT_ERROR_CHECK
(
ret
==
0
,
return
-
1
,
"Failed to format update for %s."
,
cmd
);
}
}
ret
=
-
1
;
ret
=
-
1
;
...
...
services/param/adapter/param_persistadp.c
浏览文件 @
2ba89831
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
#include <time.h>
#include <time.h>
#include <unistd.h>
#include <unistd.h>
#include "init_utils.h"
#include "param_persist.h"
#include "param_persist.h"
#include "param_utils.h"
#include "param_utils.h"
...
@@ -29,9 +30,11 @@ typedef struct {
...
@@ -29,9 +30,11 @@ typedef struct {
static
int
LoadPersistParam
(
PersistParamGetPtr
persistParamGet
,
void
*
context
)
static
int
LoadPersistParam
(
PersistParamGetPtr
persistParamGet
,
void
*
context
)
{
{
CheckAndCreateDir
(
PARAM_PERSIST_SAVE_PATH
);
CheckAndCreateDir
(
PARAM_PERSIST_SAVE_PATH
);
FILE
*
fp
=
fopen
(
PARAM_PERSIST_SAVE_TMP_PATH
,
"r"
);
int
updaterMode
=
InUpdaterMode
();
char
*
tmpPath
=
(
updaterMode
==
0
)
?
PARAM_PERSIST_SAVE_TMP_PATH
:
"/param/tmp_persist_parameters"
;
FILE
*
fp
=
fopen
(
tmpPath
,
"r"
);
if
(
fp
==
NULL
)
{
if
(
fp
==
NULL
)
{
fp
=
fopen
(
PARAM_PERSIST_SAVE_PATH
,
"r"
);
fp
=
fopen
(
(
updaterMode
==
0
)
?
PARAM_PERSIST_SAVE_PATH
:
"/param/persist_parameters"
,
"r"
);
PARAM_LOGI
(
"LoadPersistParam open file %s"
,
PARAM_PERSIST_SAVE_PATH
);
PARAM_LOGI
(
"LoadPersistParam open file %s"
,
PARAM_PERSIST_SAVE_PATH
);
}
}
PARAM_CHECK
(
fp
!=
NULL
,
return
-
1
,
"No valid persist parameter file %s"
,
PARAM_PERSIST_SAVE_PATH
);
PARAM_CHECK
(
fp
!=
NULL
,
return
-
1
,
"No valid persist parameter file %s"
,
PARAM_PERSIST_SAVE_PATH
);
...
@@ -65,7 +68,7 @@ static int SavePersistParam(const char *name, const char *value)
...
@@ -65,7 +68,7 @@ static int SavePersistParam(const char *name, const char *value)
static
int
BatchSavePersistParamBegin
(
PERSIST_SAVE_HANDLE
*
handle
)
static
int
BatchSavePersistParamBegin
(
PERSIST_SAVE_HANDLE
*
handle
)
{
{
FILE
*
fp
=
fopen
(
PARAM_PERSIST_SAVE_TMP_PATH
,
"w"
);
FILE
*
fp
=
fopen
(
(
InUpdaterMode
()
==
0
)
?
PARAM_PERSIST_SAVE_TMP_PATH
:
"/param/tmp_persist_parameters"
,
"w"
);
PARAM_CHECK
(
fp
!=
NULL
,
return
-
1
,
"Open file %s fail error %d"
,
PARAM_PERSIST_SAVE_TMP_PATH
,
errno
);
PARAM_CHECK
(
fp
!=
NULL
,
return
-
1
,
"Open file %s fail error %d"
,
PARAM_PERSIST_SAVE_TMP_PATH
,
errno
);
*
handle
=
(
PERSIST_SAVE_HANDLE
)
fp
;
*
handle
=
(
PERSIST_SAVE_HANDLE
)
fp
;
return
0
;
return
0
;
...
@@ -82,10 +85,16 @@ static int BatchSavePersistParam(PERSIST_SAVE_HANDLE handle, const char *name, c
...
@@ -82,10 +85,16 @@ static int BatchSavePersistParam(PERSIST_SAVE_HANDLE handle, const char *name, c
static
void
BatchSavePersistParamEnd
(
PERSIST_SAVE_HANDLE
handle
)
static
void
BatchSavePersistParamEnd
(
PERSIST_SAVE_HANDLE
handle
)
{
{
int
ret
;
FILE
*
fp
=
(
FILE
*
)
handle
;
FILE
*
fp
=
(
FILE
*
)
handle
;
(
void
)
fclose
(
fp
);
(
void
)
fclose
(
fp
);
if
(
InUpdaterMode
()
==
0
)
{
unlink
(
PARAM_PERSIST_SAVE_PATH
);
unlink
(
PARAM_PERSIST_SAVE_PATH
);
int
ret
=
rename
(
PARAM_PERSIST_SAVE_TMP_PATH
,
PARAM_PERSIST_SAVE_PATH
);
ret
=
rename
(
PARAM_PERSIST_SAVE_TMP_PATH
,
PARAM_PERSIST_SAVE_PATH
);
}
else
{
unlink
(
"/param/persist_parameters"
);
ret
=
rename
(
"/param/tmp_persist_parameters"
,
"/param/persist_parameters"
);
}
PARAM_CHECK
(
ret
==
0
,
return
,
"BatchSavePersistParamEnd %s fail error %d"
,
PARAM_PERSIST_SAVE_TMP_PATH
,
errno
);
PARAM_CHECK
(
ret
==
0
,
return
,
"BatchSavePersistParamEnd %s fail error %d"
,
PARAM_PERSIST_SAVE_TMP_PATH
,
errno
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录