addrom

Simple tool for adding a rom entry to a Pandora's Box 3 list.dat
Log | Files | Refs | LICENSE

commit fa893b55429c5dd123bbfae3872dd8d4234baf2d
parent 8c2100eaf0c60454a71daa879292ff95486adf29
Author: Quentin Rameau <quinq@fifth.space>
Date:   Mon,  9 Nov 2015 14:33:39 +0100

Do not exit on fclose() error. Reorder fd closing.

Diffstat:
addrom.c | 14++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/addrom.c b/addrom.c @@ -168,6 +168,10 @@ main(int argc, char *argv[]) ereadinfile(outbuf + offset + ENTRYSZ, infilesize - offset, infile); + if (fclose(infile) == EOF) + fprintf(stderr, "There was an error while closing input file " + "%s\n", in); + if (!(outfile = fopen(out, "w"))) die("Can't open output file %s\n", out); @@ -175,13 +179,11 @@ main(int argc, char *argv[]) outbufsize) die("Couldn't write all data to output file %s\n", out); - free(outbuf); - - if (fclose(infile) == EOF) - die("There was an error while closing input file %s\n", in); - if (fclose(outfile) == EOF) - die("There was an error while closing output file %s\n", out); + fprintf(stderr, "There was an error while closing output file " + "%s\n", out); + + free(outbuf); return(0); }