If we do, we won't flush, and we might not output everything.
---
toys/pending/more.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/toys/pending/more.c b/toys/pending/more.c
index 7923ee4e..fa96d40e 100644
--- a/toys/pending/more.c
+++ b/toys/pending/more.c
@@ -28,13 +28,13 @@ static void signal_handler(int sig)
// Reset the terminal whether we were signalled or exited normally.
tcsetattr(TT.cin_fd, TCSANOW, &TT.inf);
- if (sig == 0) _exit(0);
-
- // We were actually signalled, so move to a new line and re-raise the signal.
- xputc('\n');
- signal(sig, SIG_DFL);
- raise(sig);
- _exit(sig | 128);
+ // If we were actually signalled, move to a new line and re-raise the signal.
+ if (sig != 0) {
+ xputc('\n');
+ signal(sig, SIG_DFL);
+ raise(sig);
+ _exit(sig | 128);
+ }
}
static void show_file_header(const char *name)
--
2.20.1.97.g81188d93c3-goog
From 21db1d03745f0e642b2a3db14270f644c3c0359b Mon Sep 17 00:00:00 2001
From: Elliott Hughes <[email protected]>
Date: Mon, 7 Jan 2019 22:35:10 -0800
Subject: [PATCH] more: don't _exit(0) on success.
If we do, we won't flush, and we might not output everything.
---
toys/pending/more.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/toys/pending/more.c b/toys/pending/more.c
index 7923ee4e..fa96d40e 100644
--- a/toys/pending/more.c
+++ b/toys/pending/more.c
@@ -28,13 +28,13 @@ static void signal_handler(int sig)
// Reset the terminal whether we were signalled or exited normally.
tcsetattr(TT.cin_fd, TCSANOW, &TT.inf);
- if (sig == 0) _exit(0);
-
- // We were actually signalled, so move to a new line and re-raise the signal.
- xputc('\n');
- signal(sig, SIG_DFL);
- raise(sig);
- _exit(sig | 128);
+ // If we were actually signalled, move to a new line and re-raise the signal.
+ if (sig != 0) {
+ xputc('\n');
+ signal(sig, SIG_DFL);
+ raise(sig);
+ _exit(sig | 128);
+ }
}
static void show_file_header(const char *name)
--
2.20.1.97.g81188d93c3-goog
_______________________________________________
Toybox mailing list
[email protected]
http://lists.landley.net/listinfo.cgi/toybox-landley.net