index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
-rw-r--r-- | lib/libalpm/util.c | 5 |
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c index 82387b2f..458f750a 100644 --- a/lib/libalpm/util.c +++ b/lib/libalpm/util.c @@ -608,19 +608,20 @@ char *_alpm_filecache_find(const char* filename) char path[PATH_MAX]; char *retpath; alpm_list_t *i; + struct stat buf; /* Loop through the cache dirs until we find a matching file */ for(i = alpm_option_get_cachedirs(); i; i = alpm_list_next(i)) { snprintf(path, PATH_MAX, "%s%s", (char*)alpm_list_getdata(i), filename); - if(access(path, R_OK) == 0) { + if(stat(path, &buf) == 0 && S_ISREG(buf.st_mode)) { retpath = strdup(path); _alpm_log(PM_LOG_DEBUG, "found cached pkg: %s\n", retpath); return(retpath); } } /* package wasn't found in any cachedir */ - return(NULL); + RET_ERR(PM_ERR_PKG_NOT_FOUND, NULL); } /** Check the alpm cachedirs for existance and find a writable one. |