Skip to content

Commit

Permalink
More
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelortmann committed Jun 13, 2024
1 parent fd0391c commit b9a8258
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/mod/compress.mod/compress.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ static int uncompress_to_file(char *f_src, char *f_target)

fout = fopen(f_target, "wb");
if (!fout) {
gzclose(fin);
putlog(LOG_MISC, "*", "Failed to uncompress file `%s': open failed: %s.",
f_src, strerror(errno));
return COMPF_ERROR;
Expand All @@ -154,6 +155,7 @@ static int uncompress_to_file(char *f_src, char *f_target)
if (len < 0) {
putlog(LOG_MISC, "*", "Failed to uncompress file `%s': gzread failed.",
f_src);
gzclose(fin);
fclose(fout);
return COMPF_ERROR;
}
Expand All @@ -162,13 +164,15 @@ static int uncompress_to_file(char *f_src, char *f_target)
if ((int) fwrite(buf, 1, (unsigned int) len, fout) != len) {
putlog(LOG_MISC, "*", "Failed to uncompress file `%s': fwrite "
"failed: %s.", f_src, strerror(errno));
gzclose(fin);
fclose(fout);
return COMPF_ERROR;
}
}
if (fclose(fout)) {
putlog(LOG_MISC, "*", "Failed to uncompress file `%s': fclose failed: %s.",
f_src, strerror(errno));
gzclose(fin);
return COMPF_ERROR;
}
if (gzclose(fin) != Z_OK) {
Expand Down

0 comments on commit b9a8258

Please sign in to comment.