From a8444e122017873c2667b0e7dea7a4e27f09ccb7 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Tue, 22 Oct 2024 00:07:38 +0000 Subject: [PATCH] repo: Improve return code handling Signed-off-by: Michael Tremer --- src/libpakfire/repo.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/libpakfire/repo.c b/src/libpakfire/repo.c index 82e845e79..d47606a44 100644 --- a/src/libpakfire/repo.c +++ b/src/libpakfire/repo.c @@ -1306,10 +1306,8 @@ int pakfire_repo_add(struct pakfire_repo* repo, const char* path, int r; // This operation is only supported for the command line repository - if (!pakfire_repo_is_commandline(repo)) { - errno = ENOTSUP; - return 1; - } + if (!pakfire_repo_is_commandline(repo)) + return -ENOTSUP; // Download the package if we got given a URL if (pakfire_string_is_url(path)) { @@ -1322,17 +1320,17 @@ int pakfire_repo_add(struct pakfire_repo* repo, const char* path, // Try to open the archive r = pakfire_archive_open(&archive, repo->pakfire, path); - if (r) + if (r < 0) goto ERROR; // Add it to this repository r = pakfire_repo_add_archive(repo, archive, package); - if (r) + if (r < 0) goto ERROR; const char* nevra = pakfire_package_get_string(*package, PAKFIRE_PKG_NEVRA); if (!nevra) { - r = 1; + r = -errno; goto ERROR; } -- 2.47.3