diff options
author | Dan McGee <dan@archlinux.org> | 2011-06-07 18:36:30 +0200 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-06-07 18:36:30 +0200 |
commit | 992fa50dfd4faba93e37364bded015ea04d1fe15 (patch) | |
tree | abd882fc17791b586e219046744271313f63b9db | |
parent | c1a5b11f1151040e3341d9222cc246c3aa140182 (diff) | |
download | pacman-992fa50dfd4faba93e37364bded015ea04d1fe15.tar.gz pacman-992fa50dfd4faba93e37364bded015ea04d1fe15.tar.xz |
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>
-rw-r--r-- | lib/libalpm/handle.c | 12 |
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; } |