summaryrefslogtreecommitdiffstats
path: root/arch/sandbox/os
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2019-02-25 09:03:30 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2019-04-24 09:37:12 +0200
commitc5f991d2ad8ea2d872fad64dee2fd660bb0a1b20 (patch)
tree8480b1d96613251b08e40702a2b576a3d392577b /arch/sandbox/os
parentea569a0afd6a2e9a84418cd18ddeaeefaa5eae39 (diff)
downloadbarebox-c5f991d2ad8ea2d872fad64dee2fd660bb0a1b20.tar.gz
barebox-c5f991d2ad8ea2d872fad64dee2fd660bb0a1b20.tar.xz
Shell: Handle aborting loops better
It's easy to get stuck in an infinite loop in the hush shell: while true; do sleep 1; done The 'sleep' command will check for ctrl-c with the ctrlc() function. This will abort the sleep command. Hush then checks for ctrl-c again in the loop. The ctrl-c in the buffer has already been eaten by the sleep command, so the loop will continue. With this patch we remember the presence of a ctrl-c character in a variable instead of checking for a new character each time. The variable must be resetted explicitly by calling ctrlc_handled() which will be called by the shell in the outer loop. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/sandbox/os')
-rw-r--r--arch/sandbox/os/common.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/sandbox/os/common.c b/arch/sandbox/os/common.c
index 665e8194ef..a7ea8f2d3b 100644
--- a/arch/sandbox/os/common.c
+++ b/arch/sandbox/os/common.c
@@ -94,7 +94,7 @@ int linux_tstc(int fd)
return 0;
}
-int ctrlc(void)
+int arch_ctrlc(void)
{
char chr;