[PATCH] input: Call input_init on first use
Herbert Xu <[email protected]> Sun, 24 Aug 2025 09:51:04 +0800
| Newsgroups | org.kernel.vger.dash |
|---|---|
| Message-ID | <[email protected]> |
When the shell is used to execute another utility, it makes no sense to initialise stdin, which costs up to two system calls. Since the input layer can already handle first-use initialisation because of reset_init, simply make this always the case. Signed-off-by: Herbert Xu <[email protected]> diff --git a/src/input.c b/src/input.c index 1aff3d4..c36d120 100644 --- a/src/input.c +++ b/src/input.c @@ -77,7 +77,7 @@ MKINIT struct parsefile *toppf = &basepf; MKINIT struct stdin_state stdin_state; struct parsefile *parsefile = &basepf; /* current input file */ int whichprompt; /* 1 == PS1, 2 == PS2 */ -int stdin_istty; +int stdin_istty = -1; MKINIT void input_init(void); @@ -99,8 +99,6 @@ INCLUDE "syntax.h" INIT { basepf.nextc = basepf.buf = basebuf; basepf.linno = 1; - - input_init(); } RESET { -- Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt