mirror of
https://github.com/troglobit/finit.git
synced 2026-11-06 15:51:03 +00:00
Clear current line before starting built-in getty
When logging out from the shell, e.g. with Ctrl-D, artifacts from that session may remain on the current line. This patch makes sure to clear up that line before issuing a newline and starting the built-in getty. Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
b4b9111b33
commit
397f67d03a
1 file changed
+3
-2
+3
-2
@@ -211,8 +211,9 @@ static int do_login(char *name)
|
|||||||
|
|
||||||
int getty(char *tty, speed_t speed, char *term, char *user)
|
int getty(char *tty, speed_t speed, char *term, char *user)
|
||||||
{
|
{
|
||||||
int fd;
|
const char cln[] = "\r\e[2K\n";
|
||||||
char name[30];
|
char name[30];
|
||||||
|
int fd;
|
||||||
|
|
||||||
/* Detach from initial controlling TTY */
|
/* Detach from initial controlling TTY */
|
||||||
vhangup();
|
vhangup();
|
||||||
@@ -231,7 +232,7 @@ int getty(char *tty, speed_t speed, char *term, char *user)
|
|||||||
|
|
||||||
/* Set up TTY, re-enabling ISIG et al. */
|
/* Set up TTY, re-enabling ISIG et al. */
|
||||||
stty(STDIN_FILENO, speed);
|
stty(STDIN_FILENO, speed);
|
||||||
(void)write(STDOUT_FILENO, "\n", 1);
|
(void)write(STDOUT_FILENO, cln, strlen(cln));
|
||||||
|
|
||||||
/* The getty process is responsible for the UTMP login record */
|
/* The getty process is responsible for the UTMP login record */
|
||||||
utmp_set_login(tty, NULL);
|
utmp_set_login(tty, NULL);
|
||||||
|
|||||||
Reference in new issue
Block a user