user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
* [PATCH] daemon: disable SIGWINCH unless explicitly daemonized
@ 2016-06-21 10:18 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2016-06-21 10:18 UTC (permalink / raw)
  To: meta

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(-)

diff --git a/lib/PublicInbox/Daemon.pm b/lib/PublicInbox/Daemon.pm
index a25dd90..512bb20 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;

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-06-21 10:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-21 10:18 [PATCH] daemon: disable SIGWINCH unless explicitly daemonized Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).