wrapper: implement xfopen()
A common usage pattern of fopen() is to check if it succeeded, and die()
if it failed:
FILE *fp = fopen(path, "w");
if (!fp)
die_errno(_("could not open '%s' for writing"), path);
Implement a wrapper function xfopen() for the above, so that we can save
a few lines of code and make the die() messages consistent.
Helped-by: Jeff King <redacted>
Helped-by: Johannes Schindelin <redacted>
Helped-by: Junio C Hamano <redacted>
Signed-off-by: Paul Tan <redacted>
Signed-off-by: Junio C Hamano <redacted>