From: Christian Brauner Date: Tue, 26 Dec 2017 17:00:08 +0000 (+0100) Subject: console: do not allow non-pty devices on open() X-Git-Tag: lxc-2.0.10~440 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3a6b6e1db08f86e197db74478299bf1ac635c78e;p=thirdparty%2Flxc.git console: do not allow non-pty devices on open() We don't allow non-pty devices anyway so don't let open() create unneeded files. Signed-off-by: Christian Brauner --- diff --git a/src/lxc/console.c b/src/lxc/console.c index 796d77af7..bf9b8b719 100644 --- a/src/lxc/console.c +++ b/src/lxc/console.c @@ -502,9 +502,9 @@ static int lxc_console_peer_default(struct lxc_console *console) goto out; } - console->peer = lxc_unpriv(open(path, O_CLOEXEC | O_RDWR | O_CREAT | O_APPEND, 0600)); + console->peer = lxc_unpriv(open(path, O_RDWR | O_CLOEXEC)); if (console->peer < 0) { - ERROR("failed to open \"%s\": %s", path, strerror(errno)); + ERROR("Failed to open \"%s\": %s", path, strerror(errno)); return -ENOTTY; } DEBUG("using \"%s\" as peer tty device", path);