aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--configure.ac2
-rw-r--r--src/main.c14
2 files changed, 15 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 673fb33..e703aed 100644
--- a/configure.ac
+++ b/configure.ac
@@ -215,7 +215,7 @@ case $host in
*-*-linux* | *-*-*bsd* | *-*-darwin* | *-*-cygwin* | *-*-haiku*)
# NOTE: Keep this on a single line for compatibility
# with ancient versions of Autoconf.
- AC_CHECK_FUNCS([realpath readlink pathconf fchown dup dup2 getpid open read kill mmap popen pclose isatty fork execv setsid], , [
+ AC_CHECK_FUNCS([realpath readlink pathconf fchown dup dup2 getpid open read kill mmap popen pclose isatty fork execv setsid sigaction], , [
AC_MSG_ERROR([Missing libc function])
])
AC_SEARCH_LIBS(dladdr, [dl], , [
diff --git a/src/main.c b/src/main.c
index 33ab26f..29ef024 100644
--- a/src/main.c
+++ b/src/main.c
@@ -388,7 +388,21 @@ main(int argc, char **argv)
getchar();
#endif
+ /*
+ * FIXME: Gracefully handle SIGTERM.
+ * This however would require polling for the flag in Curses
+ * getch() loops.
+ * GTK already catches SIGTERM.
+ */
+#ifdef HAVE_SIGACTION
+ static const struct sigaction sigint = {
+ .sa_handler = teco_sigint_handler,
+ .sa_flags = 0 /* don't auto-restart syscalls */
+ };
+ sigaction(SIGINT, &sigint, NULL);
+#else
signal(SIGINT, teco_sigint_handler);
+#endif
/*
* Important for Unicode handling in curses and glib.