vt: add a few CLOEXEC's
These are the only open() calls missing the flag. Signed-off-by: Ran Benita <ran234@gmail.com> Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
1 parent
01698145a7
commit
0fc69a4ca5
1 file changed
+4
-3
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user