about summary refs log tree commit homepage
path: root/lib/PublicInbox
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-06-21 10:03:10 +0000
committerEric Wong <e@80x24.org>2016-06-21 10:14:46 +0000
commit73d274e83b7d300f31e0cc1ceeacbf73c6c2a1e4 (patch)
treec53e2142910d2258e7c8731eaefe783b3835cf97 /lib/PublicInbox
parent7ee0fb32fbc59b63a26e2926f3f376bb06f4a41b (diff)
downloadpublic-inbox-73d274e83b7d300f31e0cc1ceeacbf73c6c2a1e4.tar.gz
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.
Diffstat (limited to 'lib/PublicInbox')
-rw-r--r--lib/PublicInbox/Daemon.pm8
1 files changed, 4 insertions, 4 deletions
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;