]> git.ipfire.org Git - pakfire.git/commitdiff
transaction: Use cleanup function to remove all files from a filelist
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 24 Mar 2023 15:56:07 +0000 (15:56 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 24 Mar 2023 15:58:37 +0000 (15:58 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/transaction.c

index 8a2f1b4df19c100c6733b54f23f2640a91753c6a..11cd89989136dbe474e1837671786b404ac27e3e 100644 (file)
@@ -750,20 +750,10 @@ static int pakfire_transaction_erase(struct pakfire_transaction* transaction,
        if (r)
                goto ERROR;
 
-       const size_t length = pakfire_filelist_length(filelist);
-
-       // Delete all files
-       for (unsigned int i = 0; i < length; i++) {
-               struct pakfire_file* file = pakfire_filelist_get(filelist, i);
-
-               // Remove the file
-               r = pakfire_file_remove(file);
-               pakfire_file_unref(file);
-
-               // Break on any errors
-               if (r)
-                       goto ERROR;
-       }
+       // Remove all files on the filelist
+       r = pakfire_filelist_cleanup(filelist);
+       if (r)
+               goto ERROR;
 
        // Update the runtime linker cache after all files have been removed
        pakfire_jail_ldconfig(transaction->pakfire);