[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Nano-devel] [PATCH 15/17] handle deficient signal systems
From: |
Mike Frysinger |
Subject: |
[Nano-devel] [PATCH 15/17] handle deficient signal systems |
Date: |
Tue, 21 Feb 2017 17:04:47 -0500 |
Pull in the sigaction module from gnulib, and add ifdef checks
for a bunch of signals that don't exist on Windows.
---
autogen.sh | 1 +
src/nano.c | 14 ++++++++++++++
2 files changed, 15 insertions(+)
diff --git a/autogen.sh b/autogen.sh
index b2eecc2c9f75..967251ec3a05 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -13,6 +13,7 @@ modules="
iswblank
lstat
regex
+ sigaction
snprintf-posix
stdarg
strcase
diff --git a/src/nano.c b/src/nano.c
index 72abd7d43004..c6f2cef9ef88 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -1169,11 +1169,15 @@ void signal_init(void)
memset(&act, 0, sizeof(struct sigaction));
act.sa_handler = SIG_IGN;
sigaction(SIGINT, &act, NULL);
+#ifdef SIGQUIT
sigaction(SIGQUIT, &act, NULL);
+#endif
/* Trap SIGHUP and SIGTERM because we want to write the file out. */
act.sa_handler = handle_hupterm;
+#ifdef SIGHUP
sigaction(SIGHUP, &act, NULL);
+#endif
sigaction(SIGTERM, &act, NULL);
#ifndef NANO_TINY
@@ -1185,17 +1189,23 @@ void signal_init(void)
/* Trap normal suspend (^Z) so we can handle it ourselves. */
if (!ISSET(SUSPEND)) {
act.sa_handler = SIG_IGN;
+#ifdef SIGTSTP
sigaction(SIGTSTP, &act, NULL);
+#endif
} else {
/* Block all other signals in the suspend and continue handlers.
* If we don't do this, other stuff interrupts them! */
sigfillset(&act.sa_mask);
act.sa_handler = do_suspend;
+#ifdef SIGTSTP
sigaction(SIGTSTP, &act, NULL);
+#endif
act.sa_handler = do_continue;
+#ifdef SIGCONT
sigaction(SIGCONT, &act, NULL);
+#endif
}
}
@@ -1227,11 +1237,15 @@ RETSIGTYPE do_suspend(int signal)
/* Trap SIGHUP and SIGTERM so we can properly deal with them while
* suspended. */
act.sa_handler = handle_hupterm;
+#ifdef SIGHUP
sigaction(SIGHUP, &act, NULL);
+#endif
sigaction(SIGTERM, &act, NULL);
/* Do what mutt does: send ourselves a SIGSTOP. */
+#ifdef SIGSTOP
kill(0, SIGSTOP);
+#endif
}
/* The version of above function that is bound to a key. */
--
2.11.1
- [Nano-devel] [PATCH 07/17] assume regex.h support is always available, (continued)
- [Nano-devel] [PATCH 07/17] assume regex.h support is always available, Mike Frysinger, 2017/02/21
- [Nano-devel] [PATCH 12/17] fix build on systems w/out pwd.h, Mike Frysinger, 2017/02/21
- [Nano-devel] [PATCH 09/17] drop glib fallback for snprintf/vsnprintf, Mike Frysinger, 2017/02/21
- [Nano-devel] [PATCH 17/17] pull in sys_wait module from gnulib, Mike Frysinger, 2017/02/21
- [Nano-devel] [PATCH 14/17] pull in lstat module from gnulib, Mike Frysinger, 2017/02/21
- [Nano-devel] [PATCH 13/17] add an explicit test for set_escdelay, Mike Frysinger, 2017/02/21
- [Nano-devel] [PATCH 16/17] handle builds on systems w/out termios.h, Mike Frysinger, 2017/02/21
- [Nano-devel] [PATCH 02/17] gettext: update to 0.18.3 release, Mike Frysinger, 2017/02/21
- [Nano-devel] [PATCH 11/17] pull in glob module from gnulib, Mike Frysinger, 2017/02/21
- [Nano-devel] [PATCH 10/17] drop wchar.h/wctype.h/stdarg.h checks, Mike Frysinger, 2017/02/21
- [Nano-devel] [PATCH 15/17] handle deficient signal systems,
Mike Frysinger <=
- Re: [Nano-devel] [PATCH 00/17 v3] update autotools & add gnulib support, Benno Schulenberg, 2017/02/22