From 5186f702d3d426eec8a2c84bb2a8556ffa9e0736 Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Sun, 9 Sep 2012 11:13:55 +1000 Subject: 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 --- src/pacman/check.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') 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; } -- cgit v1.2.3-24-g4f1b