]> git.ipfire.org Git - pakfire.git/commitdiff
transaction: Fix truncation of integer when showing transaction
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 4 Oct 2023 17:12:17 +0000 (17:12 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 4 Oct 2023 17:12:17 +0000 (17:12 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/transaction.c

index ab21c6136b17bf5fab4f879e6d6e5a45eff17417..19a88469f478d359deac454de2bd4a70e3ed164a 100644 (file)
@@ -1185,10 +1185,18 @@ PAKFIRE_EXPORT char* pakfire_transaction_dump(struct pakfire_transaction* transa
        // How much more space do we need?
        ssize_t sizechange = pakfire_transaction_installsizechange(transaction);
 
-       r = pakfire_transaction_add_usage_line(&s, width,
-               (sizechange >= 0) ? _("Required Space") : _("Freed Space"), abs(sizechange));
-       if (r < 0)
-               goto ERROR;
+       // Show if we need more space
+       if (sizechange > 0) {
+               r = pakfire_transaction_add_usage_line(&s, width, _("Required Space"), sizechange);
+               if (r < 0)
+                       goto ERROR;
+
+       // Show if we are freeing space
+       } else if (sizechange < 0) {
+               r = pakfire_transaction_add_usage_line(&s, width, _("Freed Space"), -sizechange);
+               if (r < 0)
+                       goto ERROR;
+       }
 
        if (s)
                DEBUG(transaction->pakfire, "%s", s);