summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2012-09-09 03:13:55 +0200
committerAllan McRae <allan@archlinux.org>2012-12-14 04:45:12 +0100
commit5186f702d3d426eec8a2c84bb2a8556ffa9e0736 (patch)
tree0960be64bde890ede9636909d32dce7cd4de0bc9
parent7d27b2b0f425460be5074f50a4233c9db08fe72b (diff)
downloadpacman-5186f702d3d426eec8a2c84bb2a8556ffa9e0736.tar.gz
pacman-5186f702d3d426eec8a2c84bb2a8556ffa9e0736.tar.xz
Remove leading "./" from filenames in mtree file
A properly formatted mtree file may stick a leading "./" in front of file names in the root directory. Strip this if present. Signed-off-by: Allan McRae <allan@archlinux.org>
-rw-r--r--src/pacman/check.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/pacman/check.c b/src/pacman/check.c
index d661775b..78841c60 100644
--- a/src/pacman/check.c
+++ b/src/pacman/check.c
@@ -248,18 +248,25 @@ int check_pkg_full(alpm_pkg_t *pkg)
mode_t type;
size_t file_errors = 0;
+ /* strip leading "./" from path entries */
+ if(path[0] == '.' && path[1] == '/') {
+ path += 2;
+ }
+
if(strcmp(path, ".INSTALL") == 0) {
char filename[PATH_MAX];
snprintf(filename, PATH_MAX, "%slocal/%s-%s/install",
alpm_option_get_dbpath(config->handle) + 1,
pkgname, alpm_pkg_get_version(pkg));
archive_entry_set_pathname(entry, filename);
+ path = archive_entry_pathname(entry);
} else if(strcmp(path, ".CHANGELOG") == 0) {
char filename[PATH_MAX];
snprintf(filename, PATH_MAX, "%slocal/%s-%s/changelog",
alpm_option_get_dbpath(config->handle) + 1,
pkgname, alpm_pkg_get_version(pkg));
archive_entry_set_pathname(entry, filename);
+ path = archive_entry_pathname(entry);
} else if(*path == '.') {
continue;
}