summaryrefslogtreecommitdiff
path: root/lib/libalpm/util.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-06-03 16:42:41 -0500
committerDan McGee <dan@archlinux.org>2011-06-07 11:30:44 -0500
commit991b3ff7e63314ea14a40bb437e49ec8553abff2 (patch)
tree8c3c1fd35224971cb86e47d3fefd6c5a896a47f0 /lib/libalpm/util.c
parentcc25576f8b54b3e975949ac7991a193053b519bc (diff)
downloadpacman-991b3ff7e63314ea14a40bb437e49ec8553abff2.tar.xz
Add helper methods for setting directory options
This keeps duplicate code to a minimum. This will come in more handy as we refactor some of these option setters away. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/util.c')
-rw-r--r--lib/libalpm/util.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
index 5821bf9f..6f0763d5 100644
--- a/lib/libalpm/util.c
+++ b/lib/libalpm/util.c
@@ -56,6 +56,7 @@
#include "alpm.h"
#include "alpm_list.h"
#include "handle.h"
+#include "trans.h"
#ifndef HAVE_STRSEP
/* This is a replacement for strsep which is not portable (missing on Solaris).
@@ -606,15 +607,18 @@ const char *_alpm_filecache_setup(void)
} else if(S_ISDIR(buf.st_mode) && (buf.st_mode & S_IWUSR)) {
_alpm_log(PM_LOG_DEBUG, "using cachedir: %s\n", cachedir);
return cachedir;
+ } else {
+ _alpm_log(PM_LOG_DEBUG, "skipping cachedir: %s\n", cachedir);
}
}
/* we didn't find a valid cache directory. use /tmp. */
- tmp = alpm_list_add(NULL, strdup("/tmp/"));
+ tmp = alpm_list_add(NULL, "/tmp/");
alpm_option_set_cachedirs(tmp);
- _alpm_log(PM_LOG_DEBUG, "using cachedir: %s", "/tmp/\n");
+ alpm_list_free(tmp);
+ _alpm_log(PM_LOG_DEBUG, "using cachedir: %s\n", "/tmp/");
_alpm_log(PM_LOG_WARNING, _("couldn't create package cache, using /tmp instead\n"));
- return alpm_list_getdata(tmp);
+ return "/tmp/";
}
/** lstat wrapper that treats /path/dirsymlink/ the same as /path/dirsymlink.