1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-08-13 17:03:46 -04:00

Add cachedirs one-by-one in set_cachedirs()

This addresses the issue where calling set_cachedirs() didn't
canonicalize the passed-in paths.

Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dan McGee 2011-06-07 11:36:30 -05:00
parent c1a5b11f11
commit 992fa50dfd

View File

@ -400,9 +400,17 @@ int SYMEXPORT alpm_option_add_cachedir(const char *cachedir)
int SYMEXPORT alpm_option_set_cachedirs(alpm_list_t *cachedirs)
{
alpm_list_t *i;
ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));
if(handle->cachedirs) FREELIST(handle->cachedirs);
handle->cachedirs = alpm_list_strdup(cachedirs);
if(handle->cachedirs) {
FREELIST(handle->cachedirs);
}
for(i = cachedirs; i; i = i->next) {
int ret = alpm_option_add_cachedir(i->data);
if(ret) {
return ret;
}
}
return 0;
}