]> git.ipfire.org Git - pakfire.git/commitdiff
pakfire: Cleanup old snapshots after creating a new one
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 18 Oct 2024 15:08:43 +0000 (15:08 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 18 Oct 2024 15:08:43 +0000 (15:08 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/pakfire.c

index 5884d6aacfb0a78b1b8a2a2e79421643ca44777e..af918b7ed88fd14269dbded1e52ea770181f9201 100644 (file)
@@ -1729,7 +1729,15 @@ int pakfire_update_snapshot(struct pakfire* pakfire) {
 
        // Make a new snapshot
        r = pakfire_snapshot_make(&snapshot, pakfire, packages);
+       if (r < 0)
+               goto ERROR;
 
+       // Cleanup any old snapshots
+       r = pakfire_snapshot_clean(pakfire);
+       if (r < 0)
+               goto ERROR;
+
+ERROR:
        if (snapshot)
                pakfire_snapshot_unref(snapshot);