Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-06-07 11:36:30 -0500
committerDan McGee <dan@archlinux.org>2011-06-07 11:36:30 -0500
commit992fa50dfd4faba93e37364bded015ea04d1fe15 (patch)
treeabd882fc17791b586e219046744271313f63b9db /lib/libalpm
parentc1a5b11f1151040e3341d9222cc246c3aa140182 (diff)
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>
Diffstat (limited to 'lib/libalpm')
-rw-r--r--lib/libalpm/handle.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c
index 68a65cef..ccd13f11 100644
--- a/lib/libalpm/handle.c
+++ b/lib/libalpm/handle.c
@@ -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;
}