// Write the payload
r = pakfire_compress(packager->pakfire, a, packager->filelist, nevra,
PAKFIRE_COMPRESS_SHOW_THROUGHPUT, PAKFIRE_PACKAGER_DIGESTS);
+ if (r)
+ goto ERROR;
// Flush all buffers to disk
fflush(f);
const char* target, char** result) {
char path[PATH_MAX];
char tmppath[PATH_MAX];
+ FILE* f = NULL;
int r = 1;
// target cannot be empty
goto ERROR;
// Create a temporary result file
- FILE* f = pakfire_mktemp(tmppath);
+ f = pakfire_mktemp(tmppath);
if (!f)
goto ERROR;
// Write the finished package
r = pakfire_packager_finish(packager, f);
- fclose(f);
-
if (r) {
ERROR(packager->pakfire, "pakfire_packager_finish() failed: %m\n");
goto ERROR;
r = 0;
ERROR:
+ if (f)
+ fclose(f);
+
// Remove temporary file
if (r && *tmppath)
unlink(tmppath);