xbps-query: make -o (ownedby) follow symlinks; close issue #4 from github.

This commit is contained in:
Juan RP 2013-03-17 10:59:40 +01:00
parent 57bb7baf5e
commit 70b89a88cc
2 changed files with 17 additions and 0 deletions

3
NEWS
View File

@ -1,5 +1,8 @@
xbps-0.22 (???):
* xbps-query(8): make -o (ownedby) follow symlinks. Fix issue #4 from github.
This works in local and repository mode.
* xbps-create(8): if effective user/group is the same than files being
packaged in a package, set user/group to root:root. This way we don't
have to depend in an external tool to assume proper permissions (fakeroot).

View File

@ -109,10 +109,17 @@ int
ownedby(struct xbps_handle *xhp, int npatterns, char **patterns)
{
struct ffdata ffd;
char *rfile;
int i;
ffd.npatterns = npatterns;
ffd.patterns = patterns;
for (i = 0; i < npatterns; i++) {
rfile = realpath(patterns[i], NULL);
if (rfile)
patterns[i] = rfile;
}
return xbps_pkgdb_foreach_cb(xhp, ownedby_pkgdb_cb, &ffd);
}
@ -179,9 +186,16 @@ int
repo_ownedby(struct xbps_handle *xhp, int npatterns, char **patterns)
{
struct ffdata ffd;
char *rfile;
int i;
ffd.npatterns = npatterns;
ffd.patterns = patterns;
for (i = 0; i < npatterns; i++) {
rfile = realpath(patterns[i], NULL);
if (rfile)
patterns[i] = rfile;
}
return xbps_rpool_foreach(xhp, repo_ownedby_cb, &ffd);
}