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:
parent
c1a5b11f11
commit
992fa50dfd
1 changed files with 10 additions and 2 deletions
|
@ -400,9 +400,17 @@ int SYMEXPORT alpm_option_add_cachedir(const char *cachedir)
|
||||||
|
|
||||||
int SYMEXPORT alpm_option_set_cachedirs(alpm_list_t *cachedirs)
|
int SYMEXPORT alpm_option_set_cachedirs(alpm_list_t *cachedirs)
|
||||||
{
|
{
|
||||||
|
alpm_list_t *i;
|
||||||
ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));
|
ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));
|
||||||
if(handle->cachedirs) FREELIST(handle->cachedirs);
|
if(handle->cachedirs) {
|
||||||
handle->cachedirs = alpm_list_strdup(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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue