From 37f5a30e32a6394fc0628d4f1bbdf077d43b51bf Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Sun, 17 Jul 2022 17:05:37 +0000 Subject: [PATCH] pakfire: Correctly set return code on initialization errors Signed-off-by: Michael Tremer --- src/libpakfire/pakfire.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/libpakfire/pakfire.c b/src/libpakfire/pakfire.c index 96dff26a6..3cd962fee 100644 --- a/src/libpakfire/pakfire.c +++ b/src/libpakfire/pakfire.c @@ -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); -- 2.47.3