[lxc-devel] [lxc/lxc] 1da0ad: fix console stdin,stdout,stderr fds
GitHub
noreply at github.com
Wed Mar 5 20:59:14 UTC 2014
Branch: refs/heads/master
Home: https://github.com/lxc/lxc
Commit: 1da0ad1e0adff18c6d588772146eb054440db95b
https://github.com/lxc/lxc/commit/1da0ad1e0adff18c6d588772146eb054440db95b
Author: Dwight Engen <dwight.engen at oracle.com>
Date: 2014-03-05 (Wed, 05 Mar 2014)
Changed paths:
M src/lxc/console.c
M src/lxc/console.h
M src/lxc/lxc_console.c
M src/lxc/lxc_start.c
M src/lxc/start.c
Log Message:
-----------
fix console stdin,stdout,stderr fds
The fds for stdin,stdout,stderr that we were leaving open for /sbin/init
in the container were those from /dev/tty or lxc.console (if given), which
wasn't right. Inside the container it should only have access to the pty
that lxc creates representing the console.
This was noticed because busybox's init was resetting the termio on its
stdin which was effecting the actual users terminal instead of the pty.
This meant it was setting icanon so were were not passing keystrokes
immediately to the pty, and hence command line history/editing wasn't
working.
Fix by dup'ing the console pty to stdin,stdout,stderr just before
exec()ing /sbin/init. Fix fd leak in error handling that I noticed while
going through this code.
Also tested with lxc.console = none, lxc.console = /dev/tty7 and no
lxc.console specified.
Signed-off-by: Dwight Engen <dwight.engen at oracle.com>
Acked-by: Stéphane Graber <stgraber at ubuntu.com>
More information about the lxc-devel
mailing list