From 73d274e83b7d300f31e0cc1ceeacbf73c6c2a1e4 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 21 Jun 2016 10:03:10 +0000 Subject: daemon: disable SIGWINCH unless explicitly daemonized Checking stdin/stdout/stderr is not sufficient as the daemon without setsid can still be under the control of a terminal. Unfortunately this means systemd users cannot use SIGWINCH, either. --- lib/PublicInbox/Daemon.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/PublicInbox') diff --git a/lib/PublicInbox/Daemon.pm b/lib/PublicInbox/Daemon.pm index a25dd90f..512bb208 100644 --- a/lib/PublicInbox/Daemon.pm +++ b/lib/PublicInbox/Daemon.pm @@ -376,12 +376,12 @@ sub master_loop { exit if $quit++; kill_workers($s); } elsif ($s eq 'WINCH') { - if (-t STDIN || -t STDOUT || -t STDERR) { + if ($daemonize) { + $worker_processes = 0; + } else { warn -"ignoring SIGWINCH while connected to terminal\n"; +"ignoring SIGWINCH since we are not daemonized\n"; $SIG{WINCH} = 'IGNORE'; - } else { - $worker_processes = 0; } } elsif ($s eq 'HUP') { $worker_processes = $set_workers; -- cgit v1.2.3-24-ge0c7