提交 8e839cb4 编写于 作者: O openeuler-ci-bot 提交者: Gitee

!64 iSulad: do not use username on linux

Merge pull request !64 from lifeng_isula/fix_user
...@@ -589,11 +589,12 @@ static int proc_by_fpasswd(FILE *f_passwd, const char *user, defs_process_user * ...@@ -589,11 +589,12 @@ static int proc_by_fpasswd(FILE *f_passwd, const char *user, defs_process_user *
userfound = b_user_found(user, pwbufp); userfound = b_user_found(user, pwbufp);
// Take the first match as valid user // Take the first match as valid user
if (userfound) { if (userfound) {
// oci spec donot use username spec on linux
free(puser->username); free(puser->username);
puser->username = util_strdup_s(pwbufp->pw_name); puser->username = NULL;
puser->uid = pwbufp->pw_uid; puser->uid = pwbufp->pw_uid;
puser->gid = pwbufp->pw_gid; puser->gid = pwbufp->pw_gid;
*matched_username = puser->username; *matched_username = util_strdup_s(pwbufp->pw_name);
break; break;
} }
errval = fgetpwent_r(f_passwd, &pw, buf, sizeof(buf), &pwbufp); errval = fgetpwent_r(f_passwd, &pw, buf, sizeof(buf), &pwbufp);
...@@ -789,6 +790,7 @@ static int get_exec_user(const char *username, FILE *f_passwd, FILE *f_group, de ...@@ -789,6 +790,7 @@ static int get_exec_user(const char *username, FILE *f_passwd, FILE *f_group, de
} }
cleanup: cleanup:
free(matched_username);
free(tmp); free(tmp);
return ret; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册