1 Star 0 Fork 44

zhangxiaoyu/lxc

forked from src-openEuler/lxc 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0012-fix-dev-mount-failed-and-skip-send-recv-devpts_fd-if.patch 1.50 KB
一键复制 编辑 原始数据 按行查看 历史
From 47513b0bd34217bb2032285ea03ae7e4508ba24d Mon Sep 17 00:00:00 2001
From: zhangxiaoyu <zhangxiaoyu58@huawei.com>
Date: Fri, 12 Jan 2024 16:40:32 +0800
Subject: [PATCH] fix dev mount failed and skip send/recv devpts_fd if
disable_pty
Signed-off-by: zhangxiaoyu <zhangxiaoyu58@huawei.com>
---
src/lxc/conf.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/src/lxc/conf.c b/src/lxc/conf.c
index c73ba04..b61615d 100644
--- a/src/lxc/conf.c
+++ b/src/lxc/conf.c
@@ -1829,6 +1829,12 @@ static int lxc_recv_devpts_from_child(struct lxc_handler *handler)
{
int ret;
+#ifdef HAVE_ISULAD
+ if (handler->disable_pty) {
+ return 0;
+ }
+#endif
+
if (handler->conf->pty_max <= 0)
return 0;
@@ -2066,6 +2072,12 @@ static int lxc_send_devpts_to_parent(struct lxc_handler *handler)
{
int ret;
+#ifdef HAVE_ISULAD
+ if (handler->disable_pty) {
+ return 0;
+ }
+#endif
+
if (handler->conf->pty_max <= 0)
return log_debug(0, "No devpts file descriptor will be sent since no pts devices are requested");
@@ -4852,6 +4864,11 @@ int lxc_setup(struct lxc_handler *handler)
if (ret < 0) {
return log_error(-1, "Failed to setup new devpts instance for '%s'", name);
}
+ } else {
+ lxc_conf->devpts_fd = open_at(lxc_conf->rootfs.dfd_dev, "pts", PROTECT_OPATH_DIRECTORY, PROTECT_LOOKUP_BENEATH_XDEV, 0);
+ if (lxc_conf->devpts_fd < 0) {
+ return log_error(-1, "Failed to allocate console from container's devpts instance");
+ }
}
#else
ret = lxc_create_tmp_proc_mount(lxc_conf);
--
2.25.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zh_xiaoyu/lxc.git
git@gitee.com:zh_xiaoyu/lxc.git
zh_xiaoyu
lxc
lxc
master

搜索帮助