verify that fopen succeeded

SVN revision: 50709
This commit is contained in:
Mike Blumenkrantz 2010-07-31 05:24:47 +00:00
parent 1e8074954f
commit 5c670876c0
1 changed files with 3 additions and 2 deletions

View File

@ -314,10 +314,11 @@ output(void)
ERR("Potential security violation. attempt to write in parent dir.");
exit (-1);
}
f = fopen(out, "wb");
if (!(f = fopen(out, "wb")))
ERR("Could not open file: %s", out);
if (fwrite(font, fontsize, 1, f) != 1)
ERR("Could not write font: %s", strerror(errno));
fclose(f);
if (f) fclose(f);
free(font);
}
}