Fix #175: Ensure finit does not acquire 'dev' as controlling TTY

When starting a getty Finit checks first that the configured TTY device
actually exists and is a TTY.  This patch, by Tobias Waldekranz, ensures
Finit (PID 1) doesn't acquire the TTY device as a controlling TTY.  If
that happens PID 1 will get all signals sent to the process actually
started with the device as its controlling TTY.

Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2021-05-30 00:33:31 +02:00
parent 93a027ca23
commit 1e795d4e16
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -115,7 +115,7 @@ static void add_console(char *cons)
}
/* this requires we have /dev mounted && a device there */
fds[num_cons] = open(path, O_WRONLY);
fds[num_cons] = open(path, O_WRONLY | O_NOCTTY);
if (fds[num_cons] < 0) {
_pe("Failed opening console %s", path);
return;
+1 -1
View File
@@ -229,7 +229,7 @@ int tty_exists(char *dev)
struct termios c;
int fd, rc;
fd = open(dev, O_RDWR);
fd = open(dev, O_RDWR | O_NOCTTY);
if (-1 == fd)
return 0;