ASN.1 compiler: check write errors
This commit is contained in:

committed by
Nico Williams

parent
a3a8c1e4a4
commit
18226819cd
@@ -141,7 +141,8 @@ doit(const char *fn)
|
|||||||
}
|
}
|
||||||
printf("line: eof offset: %lu\n", (unsigned long)offset);
|
printf("line: eof offset: %lu\n", (unsigned long)offset);
|
||||||
|
|
||||||
fclose(fout);
|
if (fclose(fout) == EOF)
|
||||||
|
err(1, "writes to file %s failed", fnout);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -288,15 +288,16 @@ close_generate (void)
|
|||||||
{
|
{
|
||||||
fprintf (headerfile, "#endif /* __%s_h__ */\n", headerbase);
|
fprintf (headerfile, "#endif /* __%s_h__ */\n", headerbase);
|
||||||
|
|
||||||
if (headerfile)
|
if (headerfile && fclose(headerfile) == EOF)
|
||||||
fclose (headerfile);
|
err(1, "writes to public header file failed");
|
||||||
if (privheaderfile)
|
if (privheaderfile && fclose(privheaderfile) == EOF)
|
||||||
fclose (privheaderfile);
|
err(1, "writes to private header file failed");
|
||||||
if (templatefile)
|
if (templatefile && fclose(templatefile) == EOF)
|
||||||
fclose (templatefile);
|
err(1, "writes to template file failed");
|
||||||
if (logfile) {
|
if (logfile) {
|
||||||
fprintf (logfile, "\n");
|
fprintf(logfile, "\n");
|
||||||
fclose (logfile);
|
if (fclose(logfile) == EOF)
|
||||||
|
err(1, "writes to log file failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -399,7 +400,8 @@ close_codefile(void)
|
|||||||
if (codefile == NULL)
|
if (codefile == NULL)
|
||||||
abort();
|
abort();
|
||||||
|
|
||||||
fclose(codefile);
|
if (fclose(codefile) == EOF)
|
||||||
|
err(1, "writes to source code file failed");
|
||||||
codefile = NULL;
|
codefile = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user