]> git.ipfire.org Git - pakfire.git/commitdiff
file: Remove leading slash for "path"
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 9 Sep 2022 17:48:42 +0000 (17:48 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 9 Sep 2022 17:48:42 +0000 (17:48 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/file.c

index 56a85a7165da3f24c88e6ba0aebb27be0e980ff9..16669504f465b84f6183de0faecdd471e6c78464 100644 (file)
@@ -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)