]> git.ipfire.org Git - pakfire.git/commitdiff
cli: daemon: Correctly catch daemon initialization errors
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 22 Oct 2024 15:00:07 +0000 (15:00 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 22 Oct 2024 15:00:07 +0000 (15:00 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/cli/lib/daemon.c

index d54e5e74b89035d5dcebda69eaa58b35e8059626..4dff6b8bb26594c04998c6ad7d5e4db95288d33b 100644 (file)
@@ -31,10 +31,15 @@ int cli_daemon_main(struct pakfire_ctx* ctx) {
 
        // Create the daemon
        r = pakfire_daemon_create(&daemon, ctx);
+       if (r < 0)
+               goto ERROR;
 
        // Run the daemon
        r = pakfire_daemon_main(daemon);
+       if (r < 0)
+               goto ERROR;
 
+ERROR:
        // Cleanup
        if (daemon)
                pakfire_daemon_unref(daemon);