summaryrefslogtreecommitdiffstats
path: root/src/journal-remote/journal-gatewayd.c
diff options
context:
space:
mode:
authorFrantisek Sumsal <fsumsal@redhat.com>2023-06-18 23:26:01 +0200
committerFrantisek Sumsal <fsumsal@redhat.com>2023-06-19 10:19:44 +0200
commitf9d1806e3bc411058a146992ce11808b9b07628d (patch)
tree8977f715c65905d8f80c2197d08c70a4a49d1186 /src/journal-remote/journal-gatewayd.c
parenttest: extend the DynamicUser=yes coverage workaround to a couple more services (diff)
downloadsystemd-f9d1806e3bc411058a146992ce11808b9b07628d.tar.xz
systemd-f9d1806e3bc411058a146992ce11808b9b07628d.zip
journal-gatewayd: handle SIGTERM
To allow gatewayd to exit cleanly.
Diffstat (limited to '')
-rw-r--r--src/journal-remote/journal-gatewayd.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/journal-remote/journal-gatewayd.c b/src/journal-remote/journal-gatewayd.c
index f9bff4fb97..980b98137e 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)