libxbps: improve returned errnos for repository API functions.

- xbps_repository_update_packages: return ENOENT if regpkgdb is NULL
  (no packages currently registered).
- xbps_repository_update_packages: return EEXIST if no updates are
  available.
- xbps_repository_pool: return ENOTSUP if no repositories were
  registered.
- make xbps-{bin,repo} handle ENOTSUP errors.
This commit is contained in:
Juan RP
2011-07-29 11:17:34 +02:00
parent e71e3e9958
commit 2857214afa
6 changed files with 84 additions and 38 deletions

View File

@@ -185,6 +185,9 @@ xbps_repository_update_packages(void)
bool newpkg_found = false;
xhp = xbps_handle_get();
if (xhp->regpkgdb_dictionary == NULL)
return ENOENT;
iter = xbps_array_iter_from_dict(xhp->regpkgdb_dictionary, "packages");
if (iter == NULL)
return ENOENT;
@@ -214,7 +217,7 @@ xbps_repository_update_packages(void)
prop_object_iterator_release(iter);
if (!newpkg_found)
rv = ENXIO;
rv = EEXIST;
return rv;
}