代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/lxc 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 7273c6631f692872384cce83cc04b4084ee98f73 Mon Sep 17 00:00:00 2001
From: haozi007 <[email protected]>
Date: Tue, 9 Aug 2022 17:30:59 +0800
Subject: [PATCH] only set user or image set non-empty HOME
Signed-off-by: haozi007 <[email protected]>
---
src/lxc/isulad_utils.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/lxc/isulad_utils.c b/src/lxc/isulad_utils.c
index cd7fca8..067e1c9 100644
--- a/src/lxc/isulad_utils.c
+++ b/src/lxc/isulad_utils.c
@@ -257,6 +257,13 @@ int lxc_setup_env_home(uid_t uid)
FILE *stream = NULL;
struct passwd pw, *pwbufp = NULL;
char buf[BUFSIZ];
+ const char *curr_home = NULL;
+
+ curr_home = getenv("HOME");
+ // if user set or image set, just use it.
+ if (curr_home != NULL && strcmp(curr_home, "") != 0) {
+ return 0;
+ }
stream = fopen_cloexec(__PASSWD_FILE__, "r");
if (stream == NULL) {
@@ -280,8 +287,9 @@ set_env:
if (stream)
fclose(stream);
- // if we didn't configure HOME, set it based on uid
- if (setenv("HOME", homedir, 0) < 0) {
+ // if we didn't configure HOME, set it based on uid;
+ // override it if reach here.
+ if (setenv("HOME", homedir, 1) < 0) {
SYSERROR("Unable to set env 'HOME'");
return -1;
}
@@ -518,4 +526,4 @@ int util_getpwent_r(FILE *stream, struct passwd *resbuf, char *buffer, size_t bu
out:
funlockfile(stream);
return ret;
-}
\ No newline at end of file
+}
--
2.25.1
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。