diff options
| author | Markus Gothe | 2024-10-07 11:30:46 +0000 |
|---|---|---|
| committer | John Crispin | 2024-12-11 11:09:18 +0000 |
| commit | 30542c94c4255acfaffa8e20b88783b01fa00c4a (patch) | |
| tree | cd63eebc68066a12c7ca40735b18917f5a440225 | |
| parent | 7330fa55c5211eb7b3c675d1c7b8281b69b53553 (diff) | |
| download | procd-30542c94c4255acfaffa8e20b88783b01fa00c4a.tar.gz | |
inittab: Disable implicit controlling TTY.
Disable the use of implicit controlling
TTYs. They will be enabled on demand.
This fixes a bug where 2 or more
consecutive Ctrl-C at the login prompt
triggers a reboot of the device.
Closes: https://github.com/openwrt/openwrt/issues/11306
Signed-off-by: Markus Gothe <markus.gothe@genexis.eu>
| -rw-r--r-- | inittab.c | 2 | ||||
| -rw-r--r-- | state.c | 2 | ||||
| -rw-r--r-- | utils/utils.c | 2 |
3 files changed, 4 insertions, 2 deletions
@@ -79,7 +79,7 @@ static int dev_exist(const char *dev) if (dfd < 0) return 0; - fd = openat(dfd, dev, O_RDONLY); + fd = openat(dfd, dev, O_RDONLY|O_NOCTTY); close(dfd); if (fd < 0) @@ -79,7 +79,7 @@ static void set_console(void) return; } while (tty!=NULL) { - f = open(tty, O_RDONLY); + f = open(tty, O_RDONLY|O_NOCTTY); if (f >= 0) { close(f); break; diff --git a/utils/utils.c b/utils/utils.c index 1939dbd..ba14269 100644 --- a/utils/utils.c +++ b/utils/utils.c @@ -203,6 +203,8 @@ int patch_fd(const char *device, int fd, int flags) { int dfd, nfd; + flags |= O_NOCTTY; + if (device == NULL) device = "/dev/null"; |