From 3e6f8bf5a205fa1e0ad9d52cd13fa91f20f79018 Mon Sep 17 00:00:00 2001
From: Eric Wong <e@80x24.org>
Date: Mon, 1 Aug 2022 21:24:44 +0000
Subject: [PATCH] daemon: require absolute cert/key paths with --daemonize

This is preparation for supporting loading new certs on SIGHUP.
---
 lib/PublicInbox/Daemon.pm | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/PublicInbox/Daemon.pm b/lib/PublicInbox/Daemon.pm
index 0392d15f..87a359e7 100644
--- a/lib/PublicInbox/Daemon.pm
+++ b/lib/PublicInbox/Daemon.pm
@@ -66,6 +66,7 @@ sub accept_tls_opt ($) {
 			my $host = '';
 			$path =~ s/\A([^:]+):// and $host = $1;
 			$x->{$host} = $path;
+			check_absolute($k, $path) if $daemonize;
 		}
 	}
 	my $ctx = IO::Socket::SSL::SSL_Context->new(%ctx_opt) or
@@ -283,6 +284,8 @@ sub daemonize () {
 		check_absolute('--stdout', $stdout);
 		check_absolute('--stderr', $stderr);
 		check_absolute('--pid-file', $pid_file);
+		check_absolute('--cert', $default_cert);
+		check_absolute('--key', $default_key);
 
 		chdir '/' or die "chdir failed: $!";
 	}
-- 
2.50.0