]> git.ipfire.org Git - people/stevee/pakfire.git/commitdiff
pakfire: Correctly set return code on initialization errors
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 17 Jul 2022 17:05:37 +0000 (17:05 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 17 Jul 2022 17:05:37 +0000 (17:05 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/pakfire.c

index 96dff26a63c36fbe56f4ca4ff9171a7b5203c41e..3cd962fee8ed05d7565f4c02f59fc44b6ebfa9c3 100644 (file)
@@ -758,8 +758,10 @@ PAKFIRE_EXPORT int pakfire_create(struct pakfire** pakfire, const char* path,
        // Generate a random path if none is set
        if (!path) {
                path = pakfire_mkdtemp(tempdir);
-               if (!path)
+               if (!path) {
+                       r = 1;
                        goto ERROR;
+               }
 
                // Mount this as tmpfs
                p->mount_tmpfs = !pakfire_has_flag(p, PAKFIRE_FLAGS_DISABLE_RAMDISK);
@@ -853,8 +855,10 @@ PAKFIRE_EXPORT int pakfire_create(struct pakfire** pakfire, const char* path,
        // Make path for private files
        char private_dir[PATH_MAX];
        r = pakfire_make_path(p, private_dir, PAKFIRE_PRIVATE_DIR);
-       if (r < 0)
+       if (r < 0) {
+               r = 1;
                goto ERROR;
+       }
 
        // Make sure that our private directory exists
        r = pakfire_mkdir(private_dir, 0);