From 46d78a072252d69e7b7566b2ba0946fd932a6b4b Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Fri, 31 Jan 2025 14:39:43 +0000 Subject: [PATCH] snapshot: Create a new snapshot if the cache dir does not exist Signed-off-by: Michael Tremer --- src/pakfire/snapshot.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/pakfire/snapshot.c b/src/pakfire/snapshot.c index 817c45b6e..162defbef 100644 --- a/src/pakfire/snapshot.c +++ b/src/pakfire/snapshot.c @@ -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: -- 2.39.5