aboutsummaryrefslogtreecommitdiff
path: root/arch/sandbox/cpu/os.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2015-06-05 11:21:08 -0400
committerTom Rini <trini@konsulko.com>2015-06-05 11:21:08 -0400
commitd85cd291331b07df57fd4ada84d2c7b9b76ac1b8 (patch)
treefa3033d1e3e2f3ae80a17ee89045948383da984c /arch/sandbox/cpu/os.c
parent5d3c2c542dd8878fece0ea96edde125635b492ff (diff)
parentd9a607f2bd4315c9e370aa358ea9168d615a48fc (diff)
Merge git://git.denx.de/u-boot-dm
Diffstat (limited to 'arch/sandbox/cpu/os.c')
-rw-r--r--arch/sandbox/cpu/os.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c
index e6dd17e9ef..8a4d719835 100644
--- a/arch/sandbox/cpu/os.c
+++ b/arch/sandbox/cpu/os.c
@@ -107,10 +107,12 @@ void os_exit(int exit_code)
static struct termios orig_term;
static bool term_setup;
-static void os_fd_restore(void)
+void os_fd_restore(void)
{
- if (term_setup)
+ if (term_setup) {
tcsetattr(0, TCSANOW, &orig_term);
+ term_setup = false;
+ }
}
/* Put tty into raw mode so <tab> and <ctrl+c> work */
@@ -120,7 +122,6 @@ void os_tty_raw(int fd, bool allow_sigs)
if (term_setup)
return;
- term_setup = true;
/* If not a tty, don't complain */
if (tcgetattr(fd, &orig_term))
@@ -134,6 +135,7 @@ void os_tty_raw(int fd, bool allow_sigs)
if (tcsetattr(fd, TCSANOW, &term))
return;
+ term_setup = true;
atexit(os_fd_restore);
}