Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
#include <argp.h>
#include <stddef.h>
#include <stdlib.h>
+#include <string.h>
#include <syslog.h>
#include "ctx.h"
+#include "daemon.h"
#include "logging.h"
const char* argp_program_version = PACKAGE_VERSION;
}
int main(int argc, char* argv[]) {
+ collecty_daemon* daemon = NULL;
collecty_ctx* ctx = NULL;
struct argp parser = {
.options = options,
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);