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: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
parent 1cc8bd4b
...@@ -518,9 +518,9 @@ static int lxc_console_peer_default(struct lxc_console *console) ...@@ -518,9 +518,9 @@ static int lxc_console_peer_default(struct lxc_console *console)
goto out; 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) { if (console->peer < 0) {
ERROR("failed to open \"%s\": %s", path, strerror(errno)); ERROR("Failed to open \"%s\": %s", path, strerror(errno));
return -ENOTTY; return -ENOTTY;
} }
DEBUG("using \"%s\" as peer tty device", path); DEBUG("using \"%s\" as peer tty device", path);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment