summaryrefslogtreecommitdiffstats
path: root/src/pacman/query.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2008-05-05 02:15:49 +0200
committerDan McGee <dan@archlinux.org>2008-05-09 03:58:33 +0200
commita13bf7497948b27786a1d568264d91b8fa60491b (patch)
tree4d3a46608f22de92a92fa86ccd417694bc1907de /src/pacman/query.c
parent5389cdf65431e6daf219b9bb8f8985c6c33b1996 (diff)
downloadpacman-a13bf7497948b27786a1d568264d91b8fa60491b.tar.gz
pacman-a13bf7497948b27786a1d568264d91b8fa60491b.tar.xz
pacman-side code cleanups
When taking a look at PATH_MAX usage, I found a few small things we can clean up or fix. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'src/pacman/query.c')
-rw-r--r--src/pacman/query.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/pacman/query.c b/src/pacman/query.c
index b40359ed..0b6ce0c0 100644
--- a/src/pacman/query.c
+++ b/src/pacman/query.c
@@ -69,9 +69,8 @@ static int query_fileowner(alpm_list_t *targets)
for(t = targets; t; t = alpm_list_next(t)) {
int found = 0;
char *filename = alpm_list_getdata(t);
- char *bname;
- char *dname;
- char *rpath;
+ char *bname, *dname, *rpath;
+ const char *root;
struct stat buf;
alpm_list_t *i, *j;
@@ -101,13 +100,15 @@ static int query_fileowner(alpm_list_t *targets)
continue;
}
+ root = alpm_option_get_root();
+
for(i = alpm_db_getpkgcache(db_local); i && !found; i = alpm_list_next(i)) {
pmpkg_t *info = alpm_list_getdata(i);
for(j = alpm_pkg_get_files(info); j && !found; j = alpm_list_next(j)) {
char path[PATH_MAX], *ppath, *pdname;
snprintf(path, PATH_MAX, "%s%s",
- alpm_option_get_root(), (const char *)alpm_list_getdata(j));
+ root, (const char *)alpm_list_getdata(j));
/* avoid the costly resolve_path usage if the basenames don't match */
if(strcmp(mbasename(path), bname) != 0) {