1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-22 07:48:50 -05:00

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>
This commit is contained in:
Allan McRae 2012-09-09 11:13:55 +10:00
parent 7d27b2b0f4
commit 5186f702d3

View File

@ -248,18 +248,25 @@ int check_pkg_full(alpm_pkg_t *pkg)
mode_t type; mode_t type;
size_t file_errors = 0; size_t file_errors = 0;
/* strip leading "./" from path entries */
if(path[0] == '.' && path[1] == '/') {
path += 2;
}
if(strcmp(path, ".INSTALL") == 0) { if(strcmp(path, ".INSTALL") == 0) {
char filename[PATH_MAX]; char filename[PATH_MAX];
snprintf(filename, PATH_MAX, "%slocal/%s-%s/install", snprintf(filename, PATH_MAX, "%slocal/%s-%s/install",
alpm_option_get_dbpath(config->handle) + 1, alpm_option_get_dbpath(config->handle) + 1,
pkgname, alpm_pkg_get_version(pkg)); pkgname, alpm_pkg_get_version(pkg));
archive_entry_set_pathname(entry, filename); archive_entry_set_pathname(entry, filename);
path = archive_entry_pathname(entry);
} else if(strcmp(path, ".CHANGELOG") == 0) { } else if(strcmp(path, ".CHANGELOG") == 0) {
char filename[PATH_MAX]; char filename[PATH_MAX];
snprintf(filename, PATH_MAX, "%slocal/%s-%s/changelog", snprintf(filename, PATH_MAX, "%slocal/%s-%s/changelog",
alpm_option_get_dbpath(config->handle) + 1, alpm_option_get_dbpath(config->handle) + 1,
pkgname, alpm_pkg_get_version(pkg)); pkgname, alpm_pkg_get_version(pkg));
archive_entry_set_pathname(entry, filename); archive_entry_set_pathname(entry, filename);
path = archive_entry_pathname(entry);
} else if(*path == '.') { } else if(*path == '.') {
continue; continue;
} }