aboutsummaryrefslogtreecommitdiff
path: root/toys/other/reset.c
diff options
context:
space:
mode:
Diffstat (limited to 'toys/other/reset.c')
-rw-r--r--toys/other/reset.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/toys/other/reset.c b/toys/other/reset.c
index 0c2089cc..aa9b74ea 100644
--- a/toys/other/reset.c
+++ b/toys/other/reset.c
@@ -18,6 +18,8 @@ config RESET
void reset_main(void)
{
- // man 4 console codes: reset terminal is ESC (no left bracket) c
- xwrite(xgettty(), "\033c", 2);
+ int fd = tty_fd();
+
+ // man 4 console_codes: reset terminal is ESC (no left bracket) c
+ xwrite(fd<0 ? 1 : fd, "\033c", 2);
}