From: Serge Hallyn Date: Fri, 7 Mar 2014 00:01:08 +0000 (-0600) Subject: Revert "fix console stdin,stdout,stderr fds" X-Git-Tag: lxc-1.1.0.alpha1~234 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e5ab821d6fc9a0d6393ebd0bbf385fdd364d6dce;p=thirdparty%2Flxc.git Revert "fix console stdin,stdout,stderr fds" This reverts commit 1da0ad1e0adff18c6d588772146eb054440db95b. --- diff --git a/src/lxc/console.c b/src/lxc/console.c index 67e5d0f17..6bfc8a34c 100644 --- a/src/lxc/console.c +++ b/src/lxc/console.c @@ -506,7 +506,7 @@ static void lxc_console_peer_default(struct lxc_console *console) DEBUG("using '%s' as console", path); if (!isatty(console->peer)) - goto err1; + return; ts = lxc_console_sigwinch_init(console->peer, console->master); if (!ts) @@ -611,23 +611,7 @@ err: return -1; } -int lxc_console_set_stdfds(struct lxc_handler *handler) -{ - struct lxc_conf *conf = handler->conf; - struct lxc_console *console = &conf->console; - - if (console->slave < 0) - return 0; - if (dup2(console->slave, 0) < 0 || - dup2(console->slave, 1) < 0 || - dup2(console->slave, 2) < 0) - { - SYSERROR("failed to dup console"); - return -1; - } - return 0; -} static int lxc_console_cb_tty_stdin(int fd, uint32_t events, void *cbdata, struct lxc_epoll_descr *descr) diff --git a/src/lxc/console.h b/src/lxc/console.h index eb3894b34..d45260cbe 100644 --- a/src/lxc/console.h +++ b/src/lxc/console.h @@ -36,4 +36,3 @@ extern int lxc_console(struct lxc_container *c, int ttynum, int escape); extern int lxc_console_getfd(struct lxc_container *c, int *ttynum, int *masterfd); -extern int lxc_console_set_stdfds(struct lxc_handler *); diff --git a/src/lxc/lxc_console.c b/src/lxc/lxc_console.c index 0fd08e879..bfee6fb57 100644 --- a/src/lxc/lxc_console.c +++ b/src/lxc/lxc_console.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include diff --git a/src/lxc/lxc_start.c b/src/lxc/lxc_start.c index d9a5694e7..05fb16113 100644 --- a/src/lxc/lxc_start.c +++ b/src/lxc/lxc_start.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include diff --git a/src/lxc/start.c b/src/lxc/start.c index 89b925fc7..eb1c65955 100644 --- a/src/lxc/start.c +++ b/src/lxc/start.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -725,15 +726,6 @@ static int do_start(void *data) goto out_warn_father; } - /* Some init's such as busybox will set sane tty settings on stdin, - * stdout, stderr which it thinks is the console. We already set them - * the way we wanted on the real terminal, and we want init to do its - * 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) < 0) - goto out_warn_father; - close(handler->sigfd); /* after this call, we are in error because this