diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-05-16 13:30:37 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-05-31 13:04:18 +0200 |
commit | 63e2ebcdaa424e7ddf107312ed02edb176e2bb9f (patch) | |
tree | b155dae46537dfe9a44a9682982ad8bee30eba63 | |
parent | 40c10d3f0055ae08dd2857aecda12ce111a5ed89 (diff) | |
download | systemd-63e2ebcdaa424e7ddf107312ed02edb176e2bb9f.tar.gz |
fuzz-journal-remote: allow fuzzer to be built without µhttpd
journal-remote still requires µhttpd, but things are easier if the fuzzer
can be built without.
-rw-r--r-- | src/journal-remote/journal-remote.c | 4 | ||||
-rw-r--r-- | src/journal-remote/journal-remote.h | 6 | ||||
-rw-r--r-- | src/journal-remote/meson.build | 25 |
3 files changed, 26 insertions, 9 deletions
diff --git a/src/journal-remote/journal-remote.c b/src/journal-remote/journal-remote.c index 15e855bc8b..e1810bec19 100644 --- a/src/journal-remote/journal-remote.c +++ b/src/journal-remote/journal-remote.c @@ -342,17 +342,21 @@ int journal_remote_server_init( return 0; } +#if HAVE_MICROHTTPD static void MHDDaemonWrapper_free(MHDDaemonWrapper *d) { MHD_stop_daemon(d->daemon); sd_event_source_unref(d->io_event); sd_event_source_unref(d->timer_event); free(d); } +#endif RemoteServer* journal_remote_server_destroy(RemoteServer *s) { size_t i; +#if HAVE_MICROHTTPD hashmap_free_with_destructor(s->daemons, MHDDaemonWrapper_free); +#endif assert(s->sources_size == 0 || s->sources); for (i = 0; i < s->sources_size; i++) diff --git a/src/journal-remote/journal-remote.h b/src/journal-remote/journal-remote.h index d4e068dad8..884434cb4d 100644 --- a/src/journal-remote/journal-remote.h +++ b/src/journal-remote/journal-remote.h @@ -12,6 +12,8 @@ #include "hashmap.h" #include "journal-remote-parse.h" #include "journal-remote-write.h" + +#if HAVE_MICROHTTPD #include "microhttpd-util.h" typedef struct MHDDaemonWrapper MHDDaemonWrapper; @@ -23,6 +25,7 @@ struct MHDDaemonWrapper { sd_event_source *io_event; sd_event_source *timer_event; }; +#endif struct RemoteServer { RemoteSource **sources; @@ -36,8 +39,9 @@ struct RemoteServer { Writer *_single_writer; uint64_t event_count; +#if HAVE_MICROHTTPD Hashmap *daemons; - +#endif const char *output; /* either the output file or directory */ JournalWriteSplitMode split_mode; diff --git a/src/journal-remote/meson.build b/src/journal-remote/meson.build index 99b9003f3b..940153c5fc 100644 --- a/src/journal-remote/meson.build +++ b/src/journal-remote/meson.build @@ -8,16 +8,25 @@ systemd_journal_upload_sources = files(''' journal-upload-journal.c '''.split()) +libsystemd_journal_remote_sources = files(''' + journal-remote-parse.h + journal-remote-parse.c + journal-remote-write.h + journal-remote-write.c + journal-remote.h + journal-remote.c +'''.split()) + +if conf.get('HAVE_MICROHTTPD') == 1 + libsystemd_journal_remote_sources += files(''' + microhttpd-util.h + microhttpd-util.c +'''.split()) +endif + libsystemd_journal_remote = static_library( 'systemd-journal-remote', - 'journal-remote-parse.h', - 'journal-remote-parse.c', - 'journal-remote-write.h', - 'journal-remote-write.c', - 'journal-remote.h', - 'journal-remote.c', - 'microhttpd-util.h', - 'microhttpd-util.c', + libsystemd_journal_remote_sources, include_directories : includes, dependencies : [threads, libmicrohttpd, |