summaryrefslogtreecommitdiff
path: root/lib/libalpm/handle.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2008-01-05 17:39:38 -0600
committerDan McGee <dan@archlinux.org>2008-01-05 17:39:38 -0600
commit1a0aaa20df29234250ecc0f9fc3f56bb8cf22ca1 (patch)
treea790c25ec85a4adc1b11cc737eb86e298424673a /lib/libalpm/handle.c
parent5aa873edb696bbf678cbb57df43d90e23d562179 (diff)
downloadpacman-1a0aaa20df29234250ecc0f9fc3f56bb8cf22ca1.tar.xz
Don't stat cachedir immediately
By attempting to stat the cachedir when we load the pacman config, pacman bails out if it is a non-existant directory, even if it will never be needed. This is unfortunate as it is only used for sync transactions anyway. Instead, wait until we need it in _alpm_filecache_setup to actually do anything. Reported as FS#9096. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/handle.c')
-rw-r--r--lib/libalpm/handle.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c
index 07828115..189c934f 100644
--- a/lib/libalpm/handle.c
+++ b/lib/libalpm/handle.c
@@ -362,7 +362,6 @@ int SYMEXPORT alpm_option_set_dbpath(const char *dbpath)
int SYMEXPORT alpm_option_add_cachedir(const char *cachedir)
{
- struct stat st;
char *newcachedir;
size_t cachedirlen;
@@ -372,10 +371,9 @@ int SYMEXPORT alpm_option_add_cachedir(const char *cachedir)
pm_errno = PM_ERR_WRONG_ARGS;
return(-1);
}
- if(stat(cachedir, &st) == -1 || !S_ISDIR(st.st_mode)) {
- pm_errno = PM_ERR_NOT_A_DIR;
- return(-1);
- }
+ /* don't stat the cachedir yet, as it may not even be needed. we can
+ * fail later if it is needed and the path is invalid. */
+
/* verify cachedir ends in a '/' */
cachedirlen = strlen(cachedir);
if(cachedir[cachedirlen-1] != '/') {