index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Xavier Chantry <shiningxc@gmail.com> | 2008-08-04 01:16:08 +0200 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2008-08-05 19:30:29 -0500 |
commit | 72c5a298a3ee0f18019010ef2eb43da654ec25f8 (patch) | |
tree | d29ee5fecd2b13d972eda50710041e363a00037b /lib/libalpm | |
parent | 4476598e4e128f4595d5383ecb51a9576a447b5b (diff) |
-rw-r--r-- | lib/libalpm/db.c | 16 | ||||
-rw-r--r-- | lib/libalpm/dload.c | 1 |
diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c index 83db429d..d9a3931e 100644 --- a/lib/libalpm/db.c +++ b/lib/libalpm/db.c @@ -170,6 +170,8 @@ int SYMEXPORT alpm_db_setserver(pmdb_t *db, const char *url) { alpm_list_t *i; int found = 0; + char *newurl; + int len = 0; ALPM_LOG_FUNC; @@ -186,10 +188,18 @@ int SYMEXPORT alpm_db_setserver(pmdb_t *db, const char *url) RET_ERR(PM_ERR_DB_NOT_FOUND, -1); } - if(url && strlen(url)) { - db->servers = alpm_list_add(db->servers, strdup(url)); + if(url) { + len = strlen(url); + } + if(len) { + newurl = strdup(url); + /* strip the trailing slash if one exists */ + if(newurl[len - 1] == '/') { + newurl[len - 1] = '\0'; + } + db->servers = alpm_list_add(db->servers, newurl); _alpm_log(PM_LOG_DEBUG, "adding new server URL to database '%s': %s\n", - db->treename, url); + db->treename, newurl); } else { FREELIST(db->servers); _alpm_log(PM_LOG_DEBUG, "serverlist flushed for '%s'\n", db->treename); diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c index ef12646e..c07040b5 100644 --- a/lib/libalpm/dload.c +++ b/lib/libalpm/dload.c @@ -365,6 +365,7 @@ static int download(const char *url, const char *localpath, * than mtimeold. * - if *mtimenew is non-NULL, it will be filled with the mtime of the remote * file. + * - servers must be a list of urls WITHOUT trailing slashes. * * RETURN: 0 for successful download * 1 if the mtimes are identical |