]> git.ipfire.org Git - pakfire.git/commitdiff
archive: Ensure the target directory exists
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 9 Sep 2023 10:51:30 +0000 (10:51 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 9 Sep 2023 10:51:30 +0000 (10:51 +0000)
This causes that we could not hard-link any repositories since we put
archives into subdirectories resulting in a lot of unnecessary IO.

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

index 2152fd0d2c5c37e95d37e03971ea7e3f6d483fcc..197293a0fe8b2ceaa3e3aa54bbe192136479ac48 100644 (file)
@@ -782,6 +782,11 @@ static int pakfire_archive_link(struct pakfire_archive* archive, const char* pat
 int pakfire_archive_link_or_copy(struct pakfire_archive* archive, const char* path) {
        int r;
 
+       // Make sure the parent directory exists
+       r = pakfire_mkparentdir(path, 0755);
+       if (r)
+               return r;
+
        // Try to create a hardlink
        r = pakfire_archive_link(archive, path);
        switch (-r) {