]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
journal-gateway: use _cleanup_ attribute to stop microhttpd daemon
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 25 Nov 2018 20:13:00 +0000 (05:13 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 8 Dec 2018 09:09:40 +0000 (18:09 +0900)
src/journal-remote/journal-gatewayd.c
src/journal-remote/microhttpd-util.h

index 69bc447920ec21c1c67c1faa9e743c9133467f4a..b779a521d5104e55f1d7950620944517950c8a24 100644 (file)
@@ -982,7 +982,7 @@ static int parse_argv(int argc, char *argv[]) {
 }
 
 int main(int argc, char *argv[]) {
-        struct MHD_Daemon *d = NULL;
+        _cleanup_(MHD_stop_daemonp) struct MHD_Daemon *d = NULL;
         int r, n;
 
         log_setup_service();
@@ -1068,8 +1068,5 @@ int main(int argc, char *argv[]) {
         r = EXIT_SUCCESS;
 
 finish:
-        if (d)
-                MHD_stop_daemon(d);
-
         return r;
 }
index a50a2a75c7fc30ef56f790f7de60306516d7a7c2..364cd0f7cfd2c339e7b9475d96ac8bcc2cf29ed1 100644 (file)
@@ -73,3 +73,5 @@ int check_permissions(struct MHD_Connection *connection, int *code, char **hostn
  * interesting events without overwhelming detail.
  */
 int setup_gnutls_logger(char **categories);
+
+DEFINE_TRIVIAL_CLEANUP_FUNC(struct MHD_Daemon*, MHD_stop_daemon);