mirror of
https://github.com/sheumann/hush.git
synced 2025-01-03 00:31:16 +00:00
For "askfirst" don't just read one char from stdin,
read the whole line using getc(), so that everything before Enter gets discarded.
This commit is contained in:
parent
7e3bf6e339
commit
cbe05e45db
3
init.c
3
init.c
@ -448,14 +448,13 @@ static pid_t run(char *command, char *terminal, int get_enter)
|
|||||||
* be allowed to start a shell or whatever an init script
|
* be allowed to start a shell or whatever an init script
|
||||||
* specifies.
|
* specifies.
|
||||||
*/
|
*/
|
||||||
char c;
|
|
||||||
#ifdef DEBUG_INIT
|
#ifdef DEBUG_INIT
|
||||||
pid_t shell_pgid = getpid();
|
pid_t shell_pgid = getpid();
|
||||||
message(LOG, "Waiting for enter to start '%s' (pid %d, console %s)\r\n",
|
message(LOG, "Waiting for enter to start '%s' (pid %d, console %s)\r\n",
|
||||||
command, shell_pgid, terminal);
|
command, shell_pgid, terminal);
|
||||||
#endif
|
#endif
|
||||||
write(fileno(stdout), press_enter, sizeof(press_enter) - 1);
|
write(fileno(stdout), press_enter, sizeof(press_enter) - 1);
|
||||||
read(fileno(stdin), &c, 1);
|
getc(stdin);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_INIT
|
#ifdef DEBUG_INIT
|
||||||
|
@ -448,14 +448,13 @@ static pid_t run(char *command, char *terminal, int get_enter)
|
|||||||
* be allowed to start a shell or whatever an init script
|
* be allowed to start a shell or whatever an init script
|
||||||
* specifies.
|
* specifies.
|
||||||
*/
|
*/
|
||||||
char c;
|
|
||||||
#ifdef DEBUG_INIT
|
#ifdef DEBUG_INIT
|
||||||
pid_t shell_pgid = getpid();
|
pid_t shell_pgid = getpid();
|
||||||
message(LOG, "Waiting for enter to start '%s' (pid %d, console %s)\r\n",
|
message(LOG, "Waiting for enter to start '%s' (pid %d, console %s)\r\n",
|
||||||
command, shell_pgid, terminal);
|
command, shell_pgid, terminal);
|
||||||
#endif
|
#endif
|
||||||
write(fileno(stdout), press_enter, sizeof(press_enter) - 1);
|
write(fileno(stdout), press_enter, sizeof(press_enter) - 1);
|
||||||
read(fileno(stdin), &c, 1);
|
getc(stdin);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_INIT
|
#ifdef DEBUG_INIT
|
||||||
|
Loading…
Reference in New Issue
Block a user