summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorJoe Hershberger <joe.hershberger@ni.com>2018-07-02 20:06:48 -0500
committerJoe Hershberger <joe.hershberger@ni.com>2018-07-26 14:08:16 -0500
commitb2f58d8ee090ccf15b1366ac46a075c02a01f4fc (patch)
treea24f7274b4297530117f07a54514e0ee3a13721e /common
parent08fcdd332f3d6bc7842e21a97c80789d9233e147 (diff)
console: Remember if ctrlc is disabled in console_tstc()
We don't necessarily want to re-enable ctrl-c if it was already disabled when calling tstc(). Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/console.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/common/console.c b/common/console.c
index 2ba33dc574..36c0568dbf 100644
--- a/common/console.c
+++ b/common/console.c
@@ -196,20 +196,21 @@ static int console_tstc(int file)
{
int i, ret;
struct stdio_dev *dev;
+ int prev;
- disable_ctrlc(1);
+ prev = disable_ctrlc(1);
for (i = 0; i < cd_count[file]; i++) {
dev = console_devices[file][i];
if (dev->tstc != NULL) {
ret = dev->tstc(dev);
if (ret > 0) {
tstcdev = dev;
- disable_ctrlc(0);
+ disable_ctrlc(prev);
return ret;
}
}
}
- disable_ctrlc(0);
+ disable_ctrlc(prev);
return 0;
}