ref: 6a7ced303236cfa98b216834f197b6dab30ded4f
parent: 84ad7eaf3508c62b534b9c940afdd1362ca81e92
author: Andrew Chambers <ac@acha.ninja>
date: Mon Apr 11 09:28:37 CDT 2022
Check for io error.
--- a/minipeg.c
+++ b/minipeg.c
@@ -1274,7 +1274,7 @@
void Rule_print(Node *node) { Rule_fprint(stderr, node); }
#line 0 "peg.c"
-/* Parser generated by minipeg f0adf43 */
+/* Parser generated by minipeg 4e9111b */
#define YYRULECOUNT 38
#line 1 "peg.peg"
@@ -2806,6 +2806,11 @@
if (!nolinesFlag)
fprintf(output, "#line %i \"%s\"\n", trailerLine, fileName);
fprintf(output, "%s\n", trailer);
+ }
+
+ if (ferror(output)) {
+ fprintf(stderr, "io error writing output\n");
+ exit(1);
}
return 0;
--- a/peg.peg
+++ b/peg.peg
@@ -297,5 +297,10 @@
fprintf(output, "%s\n", trailer);
}
+ if (ferror(output)) {
+ fprintf(stderr, "io error writing output\n");
+ exit(1);
+ }
+
return 0;
}