提交 786ce71f 编写于 作者: O openharmony_ci 提交者: Gitee

!84 修改setgid

Merge pull request !84 from 熊磊/init0810
......@@ -77,13 +77,13 @@ static int SetAllAmbientCapability()
static int SetPerms(const Service *service)
{
if (KeepCapability() != 0) {
return SERVICE_FAILURE;
}
if (setgroups(service->servPerm.gIDCnt, service->servPerm.gIDArray) != 0) {
INIT_LOGE("SetPerms, setgroups failed. errno = %d, gIDCnt=%d", errno, service->servPerm.gIDCnt);
return SERVICE_FAILURE;
INIT_CHECK_RETURN_VALUE(KeepCapability() == 0, SERVICE_FAILURE);
if (service->servPerm.gIDCnt == 1) {
INIT_ERROR_CHECK(setgid(service->servPerm.gIDArray[0]) == 0, return SERVICE_FAILURE,
"SetPerms, setgid for %s failed. %d", service->name, errno);
} else if (service->servPerm.gIDCnt > 1){
INIT_ERROR_CHECK(setgroups(service->servPerm.gIDCnt, service->servPerm.gIDArray) == 0, return SERVICE_FAILURE,
"SetPerms, setgroups failed. errno = %d, gIDCnt=%d", errno, service->servPerm.gIDCnt);
}
if (service->servPerm.uID != 0) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册