]> 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>
Sat, 30 Dec 2017 22:33:54 +0000 (23:33 +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 39515e7f8cb60776758f5e7a7657c5cc0501f3c2..ac7999e4a9696b2978cfb5e3e53c5e0b195e070a 100644 (file)
@@ -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);