summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKerin Millar <kfm@plushkava.net>2023-06-11 09:49:19 +0100
committerKerin Millar <kfm@plushkava.net>2023-06-11 09:51:42 +0100
commita930fa7a97375463d02cde833f6f31c5aef479e9 (patch)
tree14529498a1e7e8e7e281ae1be1554ca0f07da8e6
parentecma48-cpr: Disable flow control in the terminal (diff)
downloadgentoo-functions-a930fa7a97375463d02cde833f6f31c5aef479e9.tar.gz
gentoo-functions-a930fa7a97375463d02cde833f6f31c5aef479e9.tar.bz2
gentoo-functions-a930fa7a97375463d02cde833f6f31c5aef479e9.zip
ecma48-cpr: Ignore SIGINT, SIGTERM and SIGTSTP
There seems little sense in honouring these signals at the point that the terminal settings are about to be altered and the CPR sequence written. Signed-off-by: Kerin Millar <kfm@plushkava.net>
-rw-r--r--ecma48-cpr.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/ecma48-cpr.c b/ecma48-cpr.c
index 7d32c63..5a0f936 100644
--- a/ecma48-cpr.c
+++ b/ecma48-cpr.c
@@ -100,6 +100,13 @@ main(void) {
/*
+ * Ignore the signals most likely to interrupt the process from hereon.
+ */
+ signal(SIGINT, SIG_IGN);
+ signal(SIGTERM, SIG_IGN);
+ signal(SIGTSTP, SIG_IGN);
+
+ /*
* Try to apply the new terminal settings.
*/
if (tcsetattr(STDIN_FILENO, TCSAFLUSH, &new_tty) != 0) {