From: Frantisek Sumsal Date: Sun, 18 Jun 2023 21:26:01 +0000 (+0200) Subject: journal-gatewayd: handle SIGTERM X-Git-Tag: v254-rc1~176^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f9d1806e3bc411058a146992ce11808b9b07628d;p=thirdparty%2Fsystemd.git journal-gatewayd: handle SIGTERM To allow gatewayd to exit cleanly. --- diff --git a/src/journal-remote/journal-gatewayd.c b/src/journal-remote/journal-gatewayd.c index f9bff4fb971..980b98137e6 100644 --- a/src/journal-remote/journal-gatewayd.c +++ b/src/journal-remote/journal-gatewayd.c @@ -31,6 +31,7 @@ #include "parse-util.h" #include "pretty-print.h" #include "sigbus.h" +#include "signal-util.h" #include "tmpfile-util.h" #define JOURNAL_WAIT_TIMEOUT (10*USEC_PER_SEC) @@ -1004,6 +1005,10 @@ static int parse_argv(int argc, char *argv[]) { static int run(int argc, char *argv[]) { _cleanup_(MHD_stop_daemonp) struct MHD_Daemon *d = NULL; + static const struct sigaction sigterm = { + .sa_handler = nop_signal_handler, + .sa_flags = SA_RESTART, + }; struct MHD_OptionItem opts[] = { { MHD_OPTION_EXTERNAL_LOGGER, (intptr_t) microhttpd_logger, NULL }, @@ -1040,6 +1045,7 @@ static int run(int argc, char *argv[]) { return r; sigbus_install(); + assert_se(sigaction(SIGTERM, &sigterm, NULL) >= 0); r = setup_gnutls_logger(NULL); if (r < 0)