From a63fade55b1e091bc1933bff181a64c38a28e302 Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Tue, 26 Dec 2017 18:00:08 +0100 Subject: [PATCH] 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 --- src/lxc/console.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lxc/console.c b/src/lxc/console.c index 39515e7f8..ac7999e4a 100644 --- a/src/lxc/console.c +++ b/src/lxc/console.c @@ -518,9 +518,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); -- 2.47.2