From 969da54ee30e375c36f582b4407e2e84ac3cb8cb Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Mon, 9 Jan 2012 01:28:36 +0200 Subject: [PATCH] vt: add a few CLOEXEC's These are the only open() calls missing the flag. Signed-off-by: Ran Benita --- src/vt.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/vt.c b/src/vt.c index 5f704d9..aeec7e8 100644 --- a/src/vt.c +++ b/src/vt.c @@ -234,9 +234,10 @@ static int open_tty(int id, int *tty_fd, int *tty_num) return -EINVAL; if (id == KMSCON_VT_NEW) { - fd = open("/dev/tty0", O_NONBLOCK | O_NOCTTY); + fd = open("/dev/tty0", O_NONBLOCK | O_NOCTTY | O_CLOEXEC); if (fd < 0) { - fd = open("/dev/tty1", O_NONBLOCK | O_NOCTTY); + fd = open("/dev/tty1", O_NONBLOCK | O_NOCTTY | + O_CLOEXEC); if (fd < 0) { log_err("vt: cannot find unused tty\n"); return -errno; @@ -255,7 +256,7 @@ static int open_tty(int id, int *tty_fd, int *tty_num) filename[sizeof(filename) - 1] = 0; log_debug("vt: using tty %s\n", filename); - fd = open(filename, O_RDWR | O_NOCTTY); + fd = open(filename, O_RDWR | O_NOCTTY | O_CLOEXEC); if (fd < 0) { log_err("vt: cannot open vt\n"); return -errno;