Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Startup Init Lite
提交
ea6b7573
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看板
未验证
提交
ea6b7573
编写于
3月 25, 2022
作者:
O
openharmony_ci
提交者:
Gitee
3月 25, 2022
浏览文件
操作
浏览文件
下载
差异文件
!440 fix: codex
Merge pull request !440 from 熊磊/0317xytcodex
上级
a3c1be4a
6f0e3351
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
32 addition
and
12 deletion
+32
-12
device_info/device_info_kits.cpp
device_info/device_info_kits.cpp
+2
-1
interfaces/innerkits/service_control/service_control.c
interfaces/innerkits/service_control/service_control.c
+1
-1
services/begetctl/main.c
services/begetctl/main.c
+3
-1
services/begetctl/param_cmd.c
services/begetctl/param_cmd.c
+1
-0
services/init/init_common_service.c
services/init/init_common_service.c
+4
-1
services/init/standard/fd_holder_service.c
services/init/standard/fd_holder_service.c
+11
-3
services/loopevent/socket/le_socket.c
services/loopevent/socket/le_socket.c
+10
-5
未找到文件。
device_info/device_info_kits.cpp
浏览文件 @
ea6b7573
...
...
@@ -129,7 +129,8 @@ const char *AclGetSerial(void)
OHOS
::
device_info
::
DeviceInfoKits
&
instance
=
OHOS
::
device_info
::
DeviceInfoKits
::
GetInstance
();
int
ret
=
instance
.
GetSerialID
(
result
);
if
(
ret
==
0
)
{
(
void
)
strcpy_s
(
serialNumber
,
sizeof
(
serialNumber
),
result
.
c_str
());
ret
=
strcpy_s
(
serialNumber
,
sizeof
(
serialNumber
),
result
.
c_str
());
DINFO_CHECK
(
ret
==
0
,
return
nullptr
,
"Failed to copy"
);
}
DINFO_LOGI
(
"GetSerial %s"
,
serialNumber
);
return
serialNumber
;
...
...
interfaces/innerkits/service_control/service_control.c
浏览文件 @
ea6b7573
...
...
@@ -221,7 +221,7 @@ int ServiceSetReady(const char *serviceName)
BEGET_LOGE
(
"Set param for %s failed."
,
paramName
);
return
-
1
;
}
BEGET_LOGI
(
"Success set %
d
read"
,
serviceName
);
BEGET_LOGI
(
"Success set %
s
read"
,
serviceName
);
return
0
;
}
...
...
services/begetctl/main.c
浏览文件 @
ea6b7573
...
...
@@ -65,7 +65,9 @@ int main(int argc, char *argv[])
args
=
argv
+
1
;
}
if
(
number
>=
1
&&
strcmp
(
args
[
0
],
"devctl"
)
==
0
)
{
(
void
)
memcpy_s
(
args
[
0
],
strlen
(
args
[
0
]),
"reboot"
,
strlen
(
"reboot"
));
if
(
memcpy_s
(
args
[
0
],
strlen
(
args
[
0
]),
"reboot"
,
strlen
(
"reboot"
))
!=
0
)
{
printf
(
"Failed to copy
\n
"
);
}
}
SetInitLogLevel
(
0
);
BShellParamCmdRegister
(
g_handle
,
0
);
...
...
services/begetctl/param_cmd.c
浏览文件 @
ea6b7573
...
...
@@ -91,6 +91,7 @@ static char *GetRealParameter(BShellHandle shell, const char *name, char *buffer
}
else
{
realLen
=
sprintf_s
(
buffer
,
buffSize
,
"%s"
,
name
);
}
BSH_CHECK
(
realLen
>
0
,
return
NULL
,
"Failed to format buffer"
);
buffer
[
realLen
]
=
'\0'
;
BSH_LOGV
(
"GetRealParameter current %s input %s real %s"
,
current
,
name
,
buffer
);
return
buffer
;
...
...
services/init/init_common_service.c
浏览文件 @
ea6b7573
...
...
@@ -229,7 +229,10 @@ static void PublishHoldFds(Service *service)
fdBuffer
[
pos
-
1
]
=
'\0'
;
// Remove last ' '
INIT_LOGI
(
"fd buffer: [%s]"
,
fdBuffer
);
char
envName
[
MAX_BUFFER_LEN
]
=
{};
(
void
)
snprintf_s
(
envName
,
MAX_BUFFER_LEN
,
MAX_BUFFER_LEN
-
1
,
ENV_FD_HOLD_PREFIX
"%s"
,
service
->
name
);
if
(
snprintf_s
(
envName
,
MAX_BUFFER_LEN
,
MAX_BUFFER_LEN
-
1
,
ENV_FD_HOLD_PREFIX
"%s"
,
service
->
name
)
<
0
)
{
INIT_LOGE
(
"snprintf_s failed err=%d"
,
errno
);
return
;
}
if
(
setenv
(
envName
,
fdBuffer
,
1
)
<
0
)
{
INIT_LOGE
(
"Failed to set env %s"
,
envName
);
}
...
...
services/init/standard/fd_holder_service.c
浏览文件 @
ea6b7573
...
...
@@ -62,12 +62,17 @@ static int HandlerHoldFds(Service *service, int *fds, size_t fdCount, const char
static
void
SendErrorInfo
(
int
sock
,
const
char
*
errInfo
,
const
char
*
serviceName
)
{
int
ret
=
0
;
char
errBuffer
[
MAX_FD_HOLDER_BUFFER
]
=
{};
if
(
UNLIKELY
(
errInfo
==
NULL
))
{
// Should not happen.
char
*
defaultError
=
"Unknonw error"
;
(
void
)
strncpy_s
(
errBuffer
,
MAX_FD_HOLDER_BUFFER
,
defaultError
,
strlen
(
defaultError
));
ret
=
strncpy_s
(
errBuffer
,
MAX_FD_HOLDER_BUFFER
,
defaultError
,
strlen
(
defaultError
));
}
else
{
(
void
)
strncpy_s
(
errBuffer
,
MAX_FD_HOLDER_BUFFER
,
errInfo
,
strlen
(
errInfo
));
ret
=
strncpy_s
(
errBuffer
,
MAX_FD_HOLDER_BUFFER
,
errInfo
,
strlen
(
errInfo
));
}
if
(
ret
!=
0
)
{
INIT_LOGE
(
"Failed to copy, err = %d"
,
errno
);
return
;
}
struct
iovec
iovec
=
{
...
...
@@ -96,7 +101,10 @@ static void SendFdsInfo(int sock, Service *service)
return
;
}
char
sendBuffer
[
MAX_FD_HOLDER_BUFFER
]
=
{};
(
void
)
strncpy_s
(
sendBuffer
,
MAX_FD_HOLDER_BUFFER
,
"send done"
,
strlen
(
"send done"
));
if
(
strncpy_s
(
sendBuffer
,
MAX_FD_HOLDER_BUFFER
,
"send done"
,
strlen
(
"send done"
))
!=
0
)
{
INIT_LOGE
(
"Failed to copy, err = %d"
,
errno
);
return
;
}
struct
iovec
iovec
=
{
.
iov_base
=
sendBuffer
,
.
iov_len
=
strlen
(
sendBuffer
),
...
...
services/loopevent/socket/le_socket.c
浏览文件 @
ea6b7573
...
...
@@ -36,11 +36,15 @@ static int CreatePipeServerSocket_(const char *server, int maxClient)
unlink
(
server
);
struct
sockaddr_un
serverAddr
;
memset_s
(
&
serverAddr
,
sizeof
(
serverAddr
),
0
,
sizeof
(
serverAddr
));
int
ret
=
memset_s
(
&
serverAddr
,
sizeof
(
serverAddr
),
0
,
sizeof
(
serverAddr
));
LE_CHECK
(
ret
==
0
,
close
(
listenfd
);
return
ret
,
"Failed to memory set. error: %s"
,
strerror
(
errno
));
serverAddr
.
sun_family
=
AF_UNIX
;
strcpy_s
(
serverAddr
.
sun_path
,
sizeof
(
serverAddr
.
sun_path
),
server
);
ret
=
strcpy_s
(
serverAddr
.
sun_path
,
sizeof
(
serverAddr
.
sun_path
),
server
);
LE_CHECK
(
ret
==
0
,
close
(
listenfd
);
return
ret
,
"Failed to copy. error: %s"
,
strerror
(
errno
));
uint32_t
size
=
offsetof
(
struct
sockaddr_un
,
sun_path
)
+
strlen
(
server
);
int
ret
=
bind
(
listenfd
,
(
struct
sockaddr
*
)
&
serverAddr
,
size
);
ret
=
bind
(
listenfd
,
(
struct
sockaddr
*
)
&
serverAddr
,
size
);
LE_CHECK
(
ret
>=
0
,
close
(
listenfd
);
return
ret
,
"Failed to bind socket. error: %s"
,
strerror
(
errno
));
...
...
@@ -91,13 +95,14 @@ static int CreatePipeSocket_(const char *server)
LE_STATUS
GetSockaddrFromServer_
(
const
char
*
server
,
struct
sockaddr_in
*
addr
)
{
memset_s
(
addr
,
sizeof
(
struct
sockaddr_in
),
0
,
sizeof
(
struct
sockaddr_in
));
int
ret
=
memset_s
(
addr
,
sizeof
(
struct
sockaddr_in
),
0
,
sizeof
(
struct
sockaddr_in
));
LE_CHECK
(
ret
==
0
,
return
ret
,
"Failed to memory set. error: %s"
,
strerror
(
errno
));
addr
->
sin_family
=
AF_INET
;
const
char
*
portStr
=
strstr
(
server
,
":"
);
LE_CHECK
(
portStr
!=
NULL
,
return
LE_FAILURE
,
"Failed to get addr %s"
,
server
);
uint16_t
port
=
atoi
(
portStr
+
1
);
addr
->
sin_port
=
htons
(
port
);
int
ret
=
inet_pton
(
AF_INET
,
server
,
&
addr
->
sin_addr
);
ret
=
inet_pton
(
AF_INET
,
server
,
&
addr
->
sin_addr
);
LE_CHECK
(
ret
>=
0
,
return
LE_FAILURE
,
"Failed to inet_pton addr %s"
,
server
);
return
LE_SUCCESS
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录