]> git.ipfire.org Git - pakfire.git/commitdiff
compress: Add entry to filelist before we modify it
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 18 Oct 2022 18:25:36 +0000 (18:25 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 18 Oct 2022 18:25:36 +0000 (18:25 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/compress.c

index 1c7c38a3b821fbad8075cecc68bfdb96a1333f76..9db8c0b52566a84fac88edb47196b4e204c14793 100644 (file)
@@ -682,6 +682,18 @@ static int __pakfire_extract(struct pakfire* pakfire, struct archive* a,
        // Fetch path
        const char* path = archive_entry_pathname(entry);
 
+       // Add entry to filelist (if requested)
+       if (data->filelist) {
+               r = pakfire_file_create_from_archive_entry(&file, pakfire, entry);
+               if (r)
+                       goto ERROR;
+
+               // Append the file to the list
+               r = pakfire_filelist_append(data->filelist, file);
+               if (r)
+                       goto ERROR;
+       }
+
        // Prepend the prefix
        if (*data->prefix) {
                // Compose file path
@@ -708,18 +720,6 @@ static int __pakfire_extract(struct pakfire* pakfire, struct archive* a,
                }
        }
 
-       // Add entry to filelist (if requested)
-       if (data->filelist) {
-               r = pakfire_file_create_from_archive_entry(&file, pakfire, entry);
-               if (r)
-                       goto ERROR;
-
-               // Append the file to the list
-               r = pakfire_filelist_append(data->filelist, file);
-               if (r)
-                       goto ERROR;
-       }
-
        // Create file & extract payload
        if (data->writer) {
                // Fetch path again since we changed it