From: Michael Tremer Date: Sat, 27 Sep 2025 12:03:03 +0000 (+0000) Subject: main: Initialize the daemon X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2a0f6cc116a7b9ec7cd629501404eb8f8ba7b104;p=telemetry.git main: Initialize the daemon Signed-off-by: Michael Tremer --- diff --git a/src/daemon/main.c b/src/daemon/main.c index 92dff8e..dbcc3fb 100644 --- a/src/daemon/main.c +++ b/src/daemon/main.c @@ -21,9 +21,11 @@ #include #include #include +#include #include #include "ctx.h" +#include "daemon.h" #include "logging.h" const char* argp_program_version = PACKAGE_VERSION; @@ -59,6 +61,7 @@ static error_t parse(int key, char* arg, struct argp_state* state) { } int main(int argc, char* argv[]) { + collecty_daemon* daemon = NULL; collecty_ctx* ctx = NULL; struct argp parser = { .options = options, @@ -78,9 +81,16 @@ int main(int argc, char* argv[]) { if (r) goto ERROR; - INFO(ctx, "Daemon initialized\n"); + // Create a daemon + r = collecty_daemon_create(&daemon, ctx); + if (r < 0) { + ERROR(ctx, "Failed to initialize the daemon: %s\n", strerror(-r)); + goto ERROR; + } ERROR: + if (daemon) + collecty_daemon_unref(daemon); if (ctx) collecty_ctx_unref(ctx);