index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Chantry Xavier <shiningxc@gmail.com> | 2007-11-25 16:13:56 -0600 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2007-11-25 16:13:56 -0600 |
commit | d683033d3ea79956faf8786f784ce2e271179892 (patch) | |
tree | bf8578705e8907b38bb95cedff77be1dd41e1ce8 /src | |
parent | 11133da587ebc1c78478cfcd05d5e8298bd61b84 (diff) |
-rw-r--r-- | src/pacman/query.c | 8 |
diff --git a/src/pacman/query.c b/src/pacman/query.c index e780d6e0..8a8765b6 100644 --- a/src/pacman/query.c +++ b/src/pacman/query.c @@ -71,6 +71,7 @@ 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 *rpath; struct stat buf; alpm_list_t *i, *j; @@ -88,6 +89,8 @@ static int query_fileowner(alpm_list_t *targets) continue; } + bname = mbasename(filename); + if(!(rpath = resolve_path(filename))) { fprintf(stderr, _("error: cannot determine real path for '%s': %s\n"), filename, strerror(errno)); @@ -103,6 +106,11 @@ static int query_fileowner(alpm_list_t *targets) snprintf(path, PATH_MAX, "%s%s", alpm_option_get_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) { + continue; + } + ppath = resolve_path(path); if(ppath && strcmp(ppath, rpath) == 0) { |