From 992fa50dfd4faba93e37364bded015ea04d1fe15 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Tue, 7 Jun 2011 11:36:30 -0500 Subject: 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 --- lib/libalpm/handle.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'lib') 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; } -- cgit v1.2.3-70-g09d2