]> git.ipfire.org Git - people/stevee/pakfire.git/commitdiff
packager: Flush all data to disk before trying to re-read the archive
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 5 Sep 2022 16:33:24 +0000 (16:33 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 5 Sep 2022 16:33:24 +0000 (16:33 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/packager.c
tests/libpakfire/packager.c

index 40321d024aa868687e0a00f410cf30b788d1c9b2..5c2287db4a39f2f7905538c1f7cd791e7cde5253 100644 (file)
@@ -428,6 +428,9 @@ int pakfire_packager_finish(struct pakfire_packager* packager, FILE* f) {
        r = pakfire_compress(packager->pakfire, a, packager->filelist, nevra,
                PAKFIRE_COMPRESS_SHOW_THROUGHPUT, PAKFIRE_PACKAGER_DIGESTS);
 
+       // Flush all buffers to disk
+       fflush(f);
+
        // Success
        r = 0;
 
index 1b85294f8ec9e247668f27bf1ccaa8d5abd617f5..e2592585c8cbec9921f8d317463da49bbadbe95a 100644 (file)
@@ -96,6 +96,7 @@ static int test_compare_metadata(const struct test* t) {
        ASSERT(f);
 
        ASSERT_SUCCESS(pakfire_packager_finish(packager, f));
+       ASSERT_SUCCESS(fclose(f));
 
        printf("Archive written to %s\n", path);