summaryrefslogtreecommitdiff
path: root/twind.c
diff options
context:
space:
mode:
authorthe xhr <xhr@giessen.ccc.de>2021-08-26 10:23:59 +0200
committerthe xhr <xhr@giessen.ccc.de>2021-08-26 10:23:59 +0200
commit75e29febe513405dbcb534883dc76a7096a207ec (patch)
treeb1e54e9e04aaa14bcb7b3a6a3f97085300acacac /twind.c
parent0321d839ea813adcaafa0dbe6463e5caa654bf1e (diff)
Re-open access and error log files on SIGHUP
Diffstat (limited to 'twind.c')
-rw-r--r--twind.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/twind.c b/twind.c
index bf3790c..bcd1393 100644
--- a/twind.c
+++ b/twind.c
@@ -92,6 +92,9 @@ static void
signal_handler(int signal)
{
switch (signal) {
+ case SIGHUP:
+ reload_log_files = 1;
+ break;
case SIGINT:
case SIGTERM:
organize_termination();
@@ -146,6 +149,8 @@ main(int argc, char *argv[])
fatalx("signal");
if (signal(SIGTERM, signal_handler) == SIG_ERR)
fatalx("signal");
+ if (signal(SIGHUP, signal_handler) == SIG_ERR)
+ fatalx("signal");
open_sockets(tcpsock, port);
@@ -252,6 +257,13 @@ handle_incoming_connections(int counter, int tcpsock, SSL_CTX *sslctx)
memset(str, 0, sizeof(str));
while (1) {
+ if (reload_log_files == 1) {
+ reload_log_files = 0;
+ log_debug("Re-open log files");
+ close_twind_logs();
+ open_twind_logs();
+ }
+
ret = accept(tcpsock, (struct sockaddr *)&addr, &len);
if (ret < 0)
fatalx("Error when accepting connection");
generated by cgit on OpenBSD