]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
lxc-console: use fd instead of 0 in setup_tios
authorQiang Huang <h.huangqiang@huawei.com>
Mon, 27 May 2013 11:10:38 +0000 (19:10 +0800)
committerSerge Hallyn <serge.hallyn@ubuntu.com>
Wed, 29 May 2013 14:03:51 +0000 (09:03 -0500)
We should use the fd specified by caller.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
src/lxc/lxc_console.c

index 820794ab961aa68156c4eff86dc25d477f27e55d..688de8070f326332f94bf3e9fad30ba7b72d4830 100644 (file)
@@ -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;
        }