summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/libalpm/alpm.h1
-rw-r--r--lib/libalpm/db.c1
-rw-r--r--lib/libalpm/dload.c2
-rw-r--r--lib/libalpm/error.c2
-rw-r--r--lib/libalpm/sync.c4
5 files changed, 9 insertions, 1 deletions
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index 5cf1e940..1b67f8a7 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -480,6 +480,7 @@ enum _pmerrno_t {
PM_ERR_DB_REMOVE,
/* Servers */
PM_ERR_SERVER_BAD_URL,
+ PM_ERR_SERVER_NONE,
/* Transactions */
PM_ERR_TRANS_NOT_NULL,
PM_ERR_TRANS_NULL,
diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c
index 561967ce..6749ab1e 100644
--- a/lib/libalpm/db.c
+++ b/lib/libalpm/db.c
@@ -232,6 +232,7 @@ const char SYMEXPORT *alpm_db_get_url(const pmdb_t *db)
/* Sanity checks */
ASSERT(handle != NULL, return(NULL));
ASSERT(db != NULL, return(NULL));
+ ASSERT(db->servers != NULL, return(NULL));
url = (char*)db->servers->data;
diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
index 5b0a691f..aec0b5ca 100644
--- a/lib/libalpm/dload.c
+++ b/lib/libalpm/dload.c
@@ -388,6 +388,8 @@ int _alpm_download_single_file(const char *filename,
alpm_list_t *i;
int ret = -1;
+ ASSERT(servers != NULL, RET_ERR(PM_ERR_SERVER_NONE, -1));
+
for(i = servers; i; i = i->next) {
const char *server = i->data;
char *fileurl = NULL;
diff --git a/lib/libalpm/error.c b/lib/libalpm/error.c
index fdff9ed4..47e254e6 100644
--- a/lib/libalpm/error.c
+++ b/lib/libalpm/error.c
@@ -84,6 +84,8 @@ const char SYMEXPORT *alpm_strerror(int err)
/* Servers */
case PM_ERR_SERVER_BAD_URL:
return _("invalid url for server");
+ case PM_ERR_SERVER_NONE:
+ return _("no servers configured for repository");
/* Transactions */
case PM_ERR_TRANS_NOT_NULL:
return _("transaction already initialized");
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index 1d42cd9d..6645335b 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -769,7 +769,9 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t **data)
if(_alpm_download_files(files, current->servers, cachedir)) {
_alpm_log(PM_LOG_WARNING, _("failed to retrieve some files from %s\n"),
current->treename);
- pm_errno = PM_ERR_RETRIEVE;
+ if(pm_errno == 0) {
+ pm_errno = PM_ERR_RETRIEVE;
+ }
goto error;
}
FREELIST(files);