]> git.ipfire.org Git - pakfire.git/commitdiff
packagelist: Fix keep going logic
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 31 Dec 2024 13:37:17 +0000 (13:37 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 31 Dec 2024 13:37:17 +0000 (13:37 +0000)
This is supposed to store the last error code and return it when the
flag is set.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/packagelist.c

index 70867aeb7ed7190bc9fefa61a53d721785179765..7d46968b8d829cb7a05ca49319d283200d4c6b5d 100644 (file)
@@ -172,13 +172,17 @@ PAKFIRE_EXPORT int pakfire_packagelist_walk(struct pakfire_packagelist* list,
                // Call the callback
                r = callback(list->ctx, element->pkg, data);
 
+               // Continue if there was no error
+               if (r == 0)
+                       continue;
+
                // Exit on error
-               if (r < 0)
+               else if (r < 0)
                        return r;
 
                // If have been asked to keep going, we
                else if (flags & PAKFIRE_PACKAGELIST_KEEPGOING)
-                       kept_going = 1;
+                       kept_going = r;
 
                else if (r > 0)
                        return r;