aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test cases/common/105 generatorcustom/gen.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/test cases/common/105 generatorcustom/gen.c b/test cases/common/105 generatorcustom/gen.c
index 59518c0..964ae7e 100644
--- a/test cases/common/105 generatorcustom/gen.c
+++ b/test cases/common/105 generatorcustom/gen.c
@@ -22,9 +22,17 @@ int main(int argc, const char ** argv) {
fprintf(output, "#pragma once\n");
fprintf(output, "#define ");
- char c;
+ int bytes_copied = 0;
+ int c;
while((c = fgetc(input)) != EOF) {
- fputc(c, output);
+ if(fputc(c, output) == EOF) {
+ fprintf(stderr, "Writing to output file failed.\n");
+ return 1;
+ }
+ if(++bytes_copied > 10000) {
+ fprintf(stderr, "File copy stuck in an eternal loop!\n");
+ return 1;
+ }
}
fputc('\n', output);