]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
console: do not allow non-pty devices on open()
authorChristian Brauner <christian.brauner@ubuntu.com>
Tue, 26 Dec 2017 17:00:08 +0000 (18:00 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Tue, 2 Jan 2018 00:25:26 +0000 (01:25 +0100)
We don't allow non-pty devices anyway so don't let open() create unneeded
files.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/console.c

index 796d77af7c2b393a10c08123bcee1ef1bf3e1347..bf9b8b7191130f807e06c5d844a526dfbc99a6a3 100644 (file)
@@ -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);