catch error from as.*printf

This commit is contained in:
Love Hornquist Astrand
2010-05-30 13:28:09 -07:00
parent 9773655027
commit 351e0d0914
5 changed files with 51 additions and 41 deletions

View File

@@ -46,7 +46,7 @@ static int
doit(const char *fn)
{
char buf[2048];
char *fnout;
char *fnout = NULL;
const char *bname;
unsigned long line = 0;
FILE *f, *fout;
@@ -62,8 +62,7 @@ doit(const char *fn)
else
bname = fn;
asprintf(&fnout, "%s.out", bname);
if (fnout == NULL)
if (asprintf(&fnout, "%s.out", bname) < 0 || fnout == NULL)
errx(1, "malloc");
fout = fopen(fnout, "w");