From: Eric Wong Date: Tue, 21 Jun 2016 10:03:10 +0000 (+0000) Subject: daemon: disable SIGWINCH unless explicitly daemonized X-Git-Tag: v1.0.0~380 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=73d274e83b7d300f31e0cc1ceeacbf73c6c2a1e4;p=public-inbox.git 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. --- 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;