summaryrefslogtreecommitdiff
path: root/src/signals.c
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2017-08-29 12:35:22 +0200
committerDaniel Friesel <derf@finalrewind.org>2017-08-29 12:35:22 +0200
commitcbf6925bba7c10cc662e375e1ab6cd47c3b1d481 (patch)
tree8dee45035fb6cc3f528fbec794ded4c857235de0 /src/signals.c
parent9e146eb61690404a33c80645fbb46b696d48d484 (diff)
Handle detaching the controlling tty from a feh process
Diffstat (limited to 'src/signals.c')
-rw-r--r--src/signals.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/signals.c b/src/signals.c
index 0b18aac..8a3a8f7 100644
--- a/src/signals.c
+++ b/src/signals.c
@@ -40,7 +40,8 @@ void setup_signal_handlers()
(sigaddset(&feh_ss, SIGALRM) == -1) ||
(sigaddset(&feh_ss, SIGTERM) == -1) ||
(sigaddset(&feh_ss, SIGQUIT) == -1) ||
- (sigaddset(&feh_ss, SIGINT) == -1))
+ (sigaddset(&feh_ss, SIGINT) == -1) ||
+ (sigaddset(&feh_ss, SIGTTIN) == -1))
{
weprintf("Failed to set up signal masks");
return;
@@ -56,7 +57,8 @@ void setup_signal_handlers()
(sigaction(SIGALRM, &feh_sh, NULL) == -1) ||
(sigaction(SIGTERM, &feh_sh, NULL) == -1) ||
(sigaction(SIGQUIT, &feh_sh, NULL) == -1) ||
- (sigaction(SIGINT, &feh_sh, NULL) == -1))
+ (sigaction(SIGINT, &feh_sh, NULL) == -1) ||
+ (sigaction(SIGTTIN, &feh_sh, NULL) == -1))
{
weprintf("Failed to set up signal handler");
return;
@@ -75,6 +77,10 @@ void feh_handle_signal(int signo)
if (childpid)
killpg(childpid, SIGINT);
return;
+ case SIGTTIN:
+ // we were probably backgrounded while we were running
+ control_via_stdin = 0;
+ return;
case SIGINT:
case SIGTERM:
case SIGQUIT: