diff options
author | Andrew Gregory <andrew.gregory.8@gmail.com> | 2013-06-19 01:23:19 -0400 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2013-06-26 15:32:16 +1000 |
commit | b36b87656ef8e341dccc5c683ed9f814c0017c67 (patch) | |
tree | 220e1358e318d4bc5f735a94e7e9e62a0c821ed4 /src | |
parent | de7ccedbe7477ec520bb035b71e9fb97ebd028c4 (diff) |
query_fileowner: remove useless path variable
We no longer need it for resolving package files and using it to
resolve root is unnecessary as alpm does that for us.
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/pacman/query.c | 30 |
1 files changed, 3 insertions, 27 deletions
diff --git a/src/pacman/query.c b/src/pacman/query.c index 25a3c5d2..f27c5c29 100644 --- a/src/pacman/query.c +++ b/src/pacman/query.c @@ -136,8 +136,8 @@ cleanup: static int query_fileowner(alpm_list_t *targets) { int ret = 0; - char path[PATH_MAX]; - size_t rootlen; + const char *root = alpm_option_get_root(config->handle); + size_t rootlen = strlen(root); alpm_list_t *t; alpm_db_t *db_local; alpm_list_t *packages; @@ -148,30 +148,6 @@ static int query_fileowner(alpm_list_t *targets) return 1; } - /* Set up our root path buffer. We only need to copy the location of root in - * once, then we can just overwrite whatever file was there on the previous - * iteration. */ - - /* resolve root now so any symlinks in it will only have to be resolved once */ - if(!realpath(alpm_option_get_root(config->handle), path)) { - pm_printf(ALPM_LOG_ERROR, _("cannot determine real path for '%s': %s\n"), - path, strerror(errno)); - return 1; - } - - /* make sure there's enough room to append the package file to path */ - rootlen = strlen(path); - if(rootlen + 2 > PATH_MAX) { - pm_printf(ALPM_LOG_ERROR, _("path too long: %s%s\n"), path, ""); - return 1; - } - - /* append trailing '/' removed by realpath */ - if(path[rootlen - 1] != '/') { - path[rootlen++] = '/'; - path[rootlen] = '\0'; - } - db_local = alpm_get_localdb(config->handle); packages = alpm_db_get_pkgcache(db_local); @@ -214,7 +190,7 @@ static int query_fileowner(alpm_list_t *targets) goto targcleanup; } - if(strncmp(rpath, path, rootlen) != 0) { + if(strncmp(rpath, root, rootlen) != 0) { /* file is outside root, we know nothing can own it */ pm_printf(ALPM_LOG_ERROR, _("No package owns %s\n"), filename); goto targcleanup; |