[lxc-devel] [PATCH] lxc-console: use fd instead of 0 in setup_tios

Qiang Huang h.huangqiang at huawei.com
Mon May 27 11:10:38 UTC 2013


We should use the fd specified by caller.

Signed-off-by: Qiang Huang <h.huangqiang at huawei.com>
---
 src/lxc/lxc_console.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/lxc/lxc_console.c b/src/lxc/lxc_console.c
index 820794a..688de80 100644
--- a/src/lxc/lxc_console.c
+++ b/src/lxc/lxc_console.c
@@ -109,7 +109,7 @@ static int setup_tios(int fd, struct termios *newtios, struct termios *oldtios)
 	}

 	/* Get current termios */
-	if (tcgetattr(0, oldtios)) {
+	if (tcgetattr(fd, oldtios)) {
 		SYSERROR("failed to get current terminal settings");
 		return -1;
 	}
@@ -125,7 +125,7 @@ static int setup_tios(int fd, struct termios *newtios, struct termios *oldtios)
 	newtios->c_cc[VTIME] = 0;

 	/* Set new attributes */
-	if (tcsetattr(0, TCSAFLUSH, newtios)) {
+	if (tcsetattr(fd, TCSAFLUSH, newtios)) {
 		ERROR("failed to set new terminal settings");
 		return -1;
 	}
-- 
1.7.1





More information about the lxc-devel mailing list