Skip to content

Commit

Permalink
Bark if rename fails
Browse files Browse the repository at this point in the history
  • Loading branch information
phaag committed May 29, 2023
1 parent 8802fa0 commit 65ea877
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/lib/nffile.c
Original file line number Diff line number Diff line change
Expand Up @@ -1600,8 +1600,11 @@ void ModifyCompressFile(int compress) {
unlink(outfile);
LogError("Failed to close file: '%s'", strerror(errno));
} else {
unlink(nffile_r->fileName);
rename(outfile, nffile_r->fileName);
if (unlink(nffile_r->fileName)) {
LogError("unlink() error in %s line %d: %s", __FILE__, __LINE__, strerror(errno));
} else if (rename(outfile, nffile_r->fileName)) {
LogError("rename() error in %s line %d: %s", __FILE__, __LINE__, strerror(errno));
}
}

DisposeFile(nffile_w);
Expand Down

0 comments on commit 65ea877

Please sign in to comment.