From: Michael Tremer Date: Tue, 22 Oct 2024 00:07:38 +0000 (+0000) Subject: repo: Improve return code handling X-Git-Tag: 0.9.30~964 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a8444e122017873c2667b0e7dea7a4e27f09ccb7;p=pakfire.git repo: Improve return code handling Signed-off-by: Michael Tremer --- 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; }