db.c: set pm_errno for server list modifications
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
This commit is contained in:
parent
dc91476555
commit
0df44c2e20
1 changed files with 6 additions and 12 deletions
|
@ -194,9 +194,8 @@ int SYMEXPORT alpm_db_add_cache_server(alpm_db_t *db, const char *url)
|
||||||
ASSERT(url != NULL && strlen(url) != 0, RET_ERR(db->handle, ALPM_ERR_WRONG_ARGS, -1));
|
ASSERT(url != NULL && strlen(url) != 0, RET_ERR(db->handle, ALPM_ERR_WRONG_ARGS, -1));
|
||||||
|
|
||||||
newurl = sanitize_url(url);
|
newurl = sanitize_url(url);
|
||||||
if(!newurl) {
|
ASSERT(newurl != NULL, RET_ERR(db->handle, ALPM_ERR_MEMORY, -1));
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
db->cache_servers = alpm_list_add(db->cache_servers, newurl);
|
db->cache_servers = alpm_list_add(db->cache_servers, newurl);
|
||||||
_alpm_log(db->handle, ALPM_LOG_DEBUG, "adding new cache server URL to database '%s': %s\n",
|
_alpm_log(db->handle, ALPM_LOG_DEBUG, "adding new cache server URL to database '%s': %s\n",
|
||||||
db->treename, newurl);
|
db->treename, newurl);
|
||||||
|
@ -214,9 +213,8 @@ int SYMEXPORT alpm_db_add_server(alpm_db_t *db, const char *url)
|
||||||
ASSERT(url != NULL && strlen(url) != 0, RET_ERR(db->handle, ALPM_ERR_WRONG_ARGS, -1));
|
ASSERT(url != NULL && strlen(url) != 0, RET_ERR(db->handle, ALPM_ERR_WRONG_ARGS, -1));
|
||||||
|
|
||||||
newurl = sanitize_url(url);
|
newurl = sanitize_url(url);
|
||||||
if(!newurl) {
|
ASSERT(newurl != NULL, RET_ERR(db->handle, ALPM_ERR_MEMORY, -1));
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
db->servers = alpm_list_add(db->servers, newurl);
|
db->servers = alpm_list_add(db->servers, newurl);
|
||||||
_alpm_log(db->handle, ALPM_LOG_DEBUG, "adding new server URL to database '%s': %s\n",
|
_alpm_log(db->handle, ALPM_LOG_DEBUG, "adding new server URL to database '%s': %s\n",
|
||||||
db->treename, newurl);
|
db->treename, newurl);
|
||||||
|
@ -235,9 +233,7 @@ int SYMEXPORT alpm_db_remove_cache_server(alpm_db_t *db, const char *url)
|
||||||
ASSERT(url != NULL && strlen(url) != 0, RET_ERR(db->handle, ALPM_ERR_WRONG_ARGS, -1));
|
ASSERT(url != NULL && strlen(url) != 0, RET_ERR(db->handle, ALPM_ERR_WRONG_ARGS, -1));
|
||||||
|
|
||||||
newurl = sanitize_url(url);
|
newurl = sanitize_url(url);
|
||||||
if(!newurl) {
|
ASSERT(newurl != NULL, RET_ERR(db->handle, ALPM_ERR_MEMORY, -1));
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
db->cache_servers = alpm_list_remove_str(db->cache_servers, newurl, &vdata);
|
db->cache_servers = alpm_list_remove_str(db->cache_servers, newurl, &vdata);
|
||||||
|
|
||||||
|
@ -263,9 +259,7 @@ int SYMEXPORT alpm_db_remove_server(alpm_db_t *db, const char *url)
|
||||||
ASSERT(url != NULL && strlen(url) != 0, RET_ERR(db->handle, ALPM_ERR_WRONG_ARGS, -1));
|
ASSERT(url != NULL && strlen(url) != 0, RET_ERR(db->handle, ALPM_ERR_WRONG_ARGS, -1));
|
||||||
|
|
||||||
newurl = sanitize_url(url);
|
newurl = sanitize_url(url);
|
||||||
if(!newurl) {
|
ASSERT(newurl != NULL, RET_ERR(db->handle, ALPM_ERR_MEMORY, -1));
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
db->servers = alpm_list_remove_str(db->servers, newurl, &vdata);
|
db->servers = alpm_list_remove_str(db->servers, newurl, &vdata);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue