未验证 提交 f8bc2afc 编写于 作者: O openharmony_ci 提交者: Gitee

!268 fix: optimize code

Merge pull request !268 from 熊磊/init126_1
......@@ -190,13 +190,13 @@ static int CheckUserInGroup(gid_t groupId, uid_t uid)
struct group *grpResult = NULL;
struct group grp = {};
int ret = getgrgid_r(groupId, &grp, buffer, sizeof(buffer), &grpResult);
if (ret != 0 || grpResult == NULL) {
if (ret != 0 || grpResult == NULL || grpResult->gr_name == NULL) {
return -1;
}
struct passwd data = {};
struct passwd *userResult = NULL;
ret = getpwuid_r(uid, &data, userBuff, sizeof(userBuff), &userResult);
if (ret != 0 || userResult == NULL) {
if (ret != 0 || userResult == NULL || userResult->pw_name == NULL) {
return -1;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册