From 47e3a3f39befea8c34fb372e7d61d9ae7fd6fcc9 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sat, 4 Jun 2011 15:08:50 +0200 Subject: [PATCH] xbps_init: add a debug printf if repository array in conf file is empty. --- lib/initend.c | 5 ++++- lib/repository_pool.c | 10 ++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/initend.c b/lib/initend.c index cc740f9d..a15fbb78 100644 --- a/lib/initend.c +++ b/lib/initend.c @@ -82,7 +82,10 @@ xbps_init(struct xbps_handle *xh) * Initialize repository pool. */ if ((rv = xbps_repository_pool_init()) != 0) { - if (rv != ENOENT) { + if (rv == ENOTSUP) { + xbps_dbg_printf("%s: empty repository list.\n", + __func__); + } else if (rv != ENOENT && rv != ENOTSUP) { xbps_dbg_printf("%s: couldn't initialize " "repository pool: %s\n", strerror(rv)); xbps_end(); diff --git a/lib/repository_pool.c b/lib/repository_pool.c index 8a9cf72e..820b1dab 100644 --- a/lib/repository_pool.c +++ b/lib/repository_pool.c @@ -67,10 +67,12 @@ xbps_repository_pool_init(void) return 0; array = prop_dictionary_get(xhp->conf_dictionary, "repositories"); - if (array == NULL) { - rv = errno; - goto out; - } + if (array == NULL) + return errno; + + if (prop_array_count(array) == 0) + return ENOTSUP; + iter = prop_array_iterator(array); if (iter == NULL) { rv = errno;