Unverified Commit 44eff075 by Christian Brauner Committed by GitHub

Merge pull request #2430 from duguhaotian/work

clear ONLCR flag for container pty
parents 508f4700 e5adb2b5
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#define _GNU_SOURCE #define _GNU_SOURCE
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <termios.h>
#include <grp.h> #include <grp.h>
#include <pwd.h> #include <pwd.h>
#include <signal.h> #include <signal.h>
...@@ -979,6 +980,7 @@ static int lxc_attach_terminal(struct lxc_conf *conf, ...@@ -979,6 +980,7 @@ static int lxc_attach_terminal(struct lxc_conf *conf,
struct lxc_terminal *terminal) struct lxc_terminal *terminal)
{ {
int ret; int ret;
struct termios oldtios;
lxc_terminal_init(terminal); lxc_terminal_init(terminal);
...@@ -988,6 +990,12 @@ static int lxc_attach_terminal(struct lxc_conf *conf, ...@@ -988,6 +990,12 @@ static int lxc_attach_terminal(struct lxc_conf *conf,
return -1; return -1;
} }
ret = lxc_setup_tios(terminal->master, &oldtios);
if (ret < 0) {
SYSERROR("Failed to setup terminal");
return -1;
}
/* Shift ttys to container. */ /* Shift ttys to container. */
ret = lxc_terminal_map_ids(conf, terminal); ret = lxc_terminal_map_ids(conf, terminal);
if (ret < 0) { if (ret < 0) {
......
...@@ -510,6 +510,7 @@ int lxc_setup_tios(int fd, struct termios *oldtios) ...@@ -510,6 +510,7 @@ int lxc_setup_tios(int fd, struct termios *oldtios)
#ifdef IEXTEN #ifdef IEXTEN
newtios.c_lflag &= ~IEXTEN; newtios.c_lflag &= ~IEXTEN;
#endif #endif
newtios.c_oflag &= ~ONLCR;
newtios.c_oflag |= OPOST; newtios.c_oflag |= OPOST;
newtios.c_cc[VMIN] = 1; newtios.c_cc[VMIN] = 1;
newtios.c_cc[VTIME] = 0; newtios.c_cc[VTIME] = 0;
...@@ -896,6 +897,7 @@ int lxc_terminal_setup(struct lxc_conf *conf) ...@@ -896,6 +897,7 @@ int lxc_terminal_setup(struct lxc_conf *conf)
{ {
int ret; int ret;
struct lxc_terminal *terminal = &conf->console; struct lxc_terminal *terminal = &conf->console;
struct termios oldtios;
if (terminal->path && strcmp(terminal->path, "none") == 0) { if (terminal->path && strcmp(terminal->path, "none") == 0) {
INFO("No terminal requested"); INFO("No terminal requested");
...@@ -906,6 +908,10 @@ int lxc_terminal_setup(struct lxc_conf *conf) ...@@ -906,6 +908,10 @@ int lxc_terminal_setup(struct lxc_conf *conf)
if (ret < 0) if (ret < 0)
return -1; return -1;
ret = lxc_setup_tios(terminal->master, &oldtios);
if (ret < 0)
return -1;
ret = lxc_terminal_create_log_file(terminal); ret = lxc_terminal_create_log_file(terminal);
if (ret < 0) if (ret < 0)
goto err; goto err;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment