]> git.ipfire.org Git - pakfire.git/commitdiff
downloader: Always flush the output, even if not written to a file
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 17 Oct 2023 16:24:11 +0000 (16:24 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 17 Oct 2023 16:24:11 +0000 (16:24 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/downloader.c

index be14917dbdb610da25fa9656f33591d45e398a1e..0c9aa96ef47e966661f0f4ea644cc8053550649e 100644 (file)
@@ -588,6 +588,10 @@ static int pakfire_transfer_save(struct pakfire_downloader* downloader,
        };
        int r;
 
+       // Flush any buffered data out to disk
+       if (transfer->f)
+               fflush(transfer->f);
+
        // Nothing to do if path isn't set
        if (!*transfer->path)
                return 0;
@@ -595,9 +599,6 @@ static int pakfire_transfer_save(struct pakfire_downloader* downloader,
        CTX_DEBUG(downloader->ctx,
                "Download successful. Storing result in %s\n", transfer->path);
 
-       // Flush any buffered data out to disk
-       fflush(transfer->f);
-
        // Make sure the parent directory exists
        r = pakfire_mkparentdir(transfer->path, 0755);
        if (r)