Skip to content

Commit

Permalink
console: do not allow non-pty devices on open()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Christian Brauner committed Jan 2, 2018
1 parent afa93cd commit 3a6b6e1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lxc/console.c
Expand Up @@ -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);
Expand Down

0 comments on commit 3a6b6e1

Please sign in to comment.