]> git.ipfire.org Git - pakfire.git/commitdiff
snapshot: Create a new snapshot if the cache dir does not exist
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 31 Jan 2025 14:39:43 +0000 (14:39 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 31 Jan 2025 14:39:43 +0000 (14:39 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/pakfire/snapshot.c

index 817c45b6e7c0d30d12f0c1b67d0fdc842510d68c..162defbef876bc7be9cb275e77ff83d4c57ff44a 100644 (file)
@@ -216,9 +216,13 @@ int pakfire_snapshot_find(struct pakfire_snapshot** snapshot, struct pakfire* pa
        fd = open(path, O_DIRECTORY|O_CLOEXEC);
        if (fd < 0) {
                switch (errno) {
-                       // If the directory does not exist, we cannot find a snapshot
+                       // If the directory does not exist, we will make a new snapshot
                        case ENOENT:
-                               r = 0;
+                               r = pakfire_snapshot_make(snapshot, pakfire);
+                               if (r < 0)
+                                       goto ERROR;
+
+                               // Anyways, we are done
                                goto ERROR;
 
                        default: