mirror of
https://github.com/troglobit/finit.git
synced 2026-10-02 14:02:52 +07:00
Allow Ctrl-U, Ctrl-D again in built-in getty
Many users found it very frustrating that it was impossible to use standard commands like Ctrl-U and Ctrl-D at the login: prompt. It was never the intention to hamper users for no reason like that. Also, compensate for cursor-up in "Please press Enter" wait-handler. Curiously, this makes everything very neat looking also when having 'nowait' enabled for the tty. Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
+5
-4
@@ -224,10 +224,15 @@ int getty(char *tty, speed_t speed, char *term, char *user)
|
||||
dup2(fd, STDIN_FILENO);
|
||||
dup2(fd, STDOUT_FILENO);
|
||||
dup2(fd, STDERR_FILENO);
|
||||
close(fd);
|
||||
|
||||
if (ioctl(STDIN_FILENO, TIOCSCTTY, 1) < 0)
|
||||
warn("Failed TIOCSCTTY");
|
||||
|
||||
/* Set up TTY, re-enabling ISIG et al. */
|
||||
stty(STDIN_FILENO, speed);
|
||||
(void)write(STDOUT_FILENO, "\n", 1);
|
||||
|
||||
/* The getty process is responsible for the UTMP login record */
|
||||
utmp_set_login(tty, NULL);
|
||||
if (!user)
|
||||
@@ -235,10 +240,6 @@ int getty(char *tty, speed_t speed, char *term, char *user)
|
||||
else
|
||||
strlcpy(name, user, sizeof(name));
|
||||
|
||||
/* Set up TTY, re-enabling ISIG et al. */
|
||||
stty(fd, speed);
|
||||
close(fd);
|
||||
|
||||
if (term && term[0])
|
||||
setenv("TERM", term, 1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user