From: Michael Tremer Date: Fri, 9 Sep 2022 17:48:42 +0000 (+0000) Subject: file: Remove leading slash for "path" X-Git-Tag: 0.9.28~313 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d7b476ef4f2ab6245b82375c246b43483d8727c8;p=pakfire.git file: Remove leading slash for "path" Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/file.c b/src/libpakfire/file.c index 56a85a716..16669504f 100644 --- a/src/libpakfire/file.c +++ b/src/libpakfire/file.c @@ -271,6 +271,8 @@ ERROR: } struct archive_entry* pakfire_file_archive_entry(struct pakfire_file* file, int digest_types) { + const char* path = NULL; + struct archive_entry* entry = archive_entry_new(); if (!entry) { ERROR(file->pakfire, "Could not allocate archive entry: %m\n"); @@ -281,7 +283,10 @@ struct archive_entry* pakfire_file_archive_entry(struct pakfire_file* file, int archive_entry_copy_sourcepath(entry, file->abspath); // Set path - archive_entry_copy_pathname(entry, pakfire_file_get_path(file)); + path = pakfire_file_get_path(file); + if (path && *path == '/') { + archive_entry_copy_pathname(entry, path + 1); + } // Set links if (*file->hardlink)