]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
clear ONLCR flag for container pty 2430/head
authorduguhaotian <duguhaotian@gmail.com>
Tue, 26 Jun 2018 01:57:04 +0000 (09:57 +0800)
committerduguhaotian <duguhaotian@gmail.com>
Tue, 26 Jun 2018 11:39:29 +0000 (19:39 +0800)
now container pty output log, use \r\n as a newline flag.
This is a windows type, so we need to change it. By clear
ONLCR can reach it.

Signed-off-by: duguhaotian <duguhaotian@gmail.com>
src/lxc/attach.c
src/lxc/terminal.c

index 429a5d86cdbe1ac0569682e618d1d46eb63ff8b9..0478092caeda4216065fe07446e28693499c17eb 100644 (file)
@@ -24,6 +24,7 @@
 #define _GNU_SOURCE
 #include <errno.h>
 #include <fcntl.h>
+#include <termios.h>
 #include <grp.h>
 #include <pwd.h>
 #include <signal.h>
@@ -979,6 +980,7 @@ static int lxc_attach_terminal(struct lxc_conf *conf,
                               struct lxc_terminal *terminal)
 {
        int ret;
+       struct termios oldtios;
 
        lxc_terminal_init(terminal);
 
@@ -988,6 +990,12 @@ static int lxc_attach_terminal(struct lxc_conf *conf,
                return -1;
        }
 
+       ret = lxc_setup_tios(terminal->master, &oldtios);
+       if (ret < 0) {
+               SYSERROR("Failed to setup terminal");
+               return -1;
+       }
+
        /* Shift ttys to container. */
        ret = lxc_terminal_map_ids(conf, terminal);
        if (ret < 0) {
index eb745c5ff52bc211fec4bfdbd3cedf8a32e08095..9972e1978055c327462f10772a8661ec26d3e224 100644 (file)
@@ -509,6 +509,7 @@ int lxc_setup_tios(int fd, struct termios *oldtios)
 #ifdef IEXTEN
        newtios.c_lflag &= ~IEXTEN;
 #endif
+       newtios.c_oflag &= ~ONLCR;
        newtios.c_oflag |= OPOST;
        newtios.c_cc[VMIN] = 1;
        newtios.c_cc[VTIME] = 0;
@@ -897,6 +898,7 @@ int lxc_terminal_setup(struct lxc_conf *conf)
 {
        int ret;
        struct lxc_terminal *terminal = &conf->console;
+       struct termios oldtios;
 
        if (terminal->path && strcmp(terminal->path, "none") == 0) {
                INFO("No terminal requested");
@@ -907,6 +909,10 @@ int lxc_terminal_setup(struct lxc_conf *conf)
        if (ret < 0)
                return -1;
 
+       ret = lxc_setup_tios(terminal->master, &oldtios);
+       if (ret < 0)
+               return -1;
+
        ret = lxc_terminal_create_log_file(terminal);
        if (ret < 0)
                goto err;