[lxc-devel] [lxc/master] Fix issue #1646, dup the STD{in, out, err} of the container to the slave of the PTY
lifeng68 on Github
lxc-bot at linuxcontainers.org
Mon Jul 10 01:20:52 UTC 2017
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 743 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170710/99404919/attachment.bin>
-------------- next part --------------
From ca48f8028c4e994f1cbaa5aeb24a4168e473255f Mon Sep 17 00:00:00 2001
From: Li Feng <lifeng68 at huawei.com>
Date: Mon, 10 Jul 2017 17:19:52 +0800
Subject: [PATCH] Fix issue #1646, dup the STD{in,out,err} of the container to
the slave of the PTY
Signed-off-by: Li Feng <lifeng68 at huawei.com>
---
src/lxc/start.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/lxc/start.c b/src/lxc/start.c
index 9a7e462d0..b2586d31e 100644
--- a/src/lxc/start.c
+++ b/src/lxc/start.c
@@ -1063,8 +1063,9 @@ static int do_start(void *data)
* setup on its console ie. the pty allocated in lxc_console_create() so
* make sure that that pty is stdin,stdout,stderr.
*/
- if (lxc_console_set_stdfds(handler->conf->console.slave) < 0)
- goto out_warn_father;
+ if (handler->conf->console.slave >= 0)
+ if (set_stdfds(handler->conf->console.slave) < 0)
+ goto out_warn_father;
/* If we mounted a temporary proc, then unmount it now. */
tmp_proc_unmount(handler->conf);
@@ -1142,7 +1143,7 @@ static int do_start(void *data)
goto out_warn_father;
}
- if (handler->backgrounded && set_stdfds(devnull_fd))
+ if (handler->conf->console.slave < 0 && handler->backgrounded && set_stdfds(devnull_fd))
goto out_warn_father;
if (devnull_fd >= 0) {
More information about the lxc-devel
mailing list