[PATCH] input: Check for int_pending while clearing input

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jan 04, 2023 at 02:59:23PM +0000, Harald van Dijk wrote:
>
> As long as we're talking about things like that, regardless of how it's
> implemented, we could also get another SIGINT during the skipping of the
> rest of the input line.

Actually, that's a good point and we should stop clearing the line
if we detect SIGINT.

---8<---
If we receive SIGINT while clearing a partially read line from
stdin we should bail out instead of continuing.

Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>

diff --git a/src/input.c b/src/input.c
index 8691617..1c83287 100644
--- a/src/input.c
+++ b/src/input.c
@@ -89,7 +89,8 @@ RESET {
 	popallfiles();
 	basepf.unget = 0;
 	while (basepf.lastc[0] != '\n' &&
-	       basepf.lastc[0] != PEOF)
+	       basepf.lastc[0] != PEOF &&
+	       !int_pending())
 		pgetc();
 }
 
Thanks,
-- 
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux