summaryrefslogtreecommitdiffstats
path: root/debian/patches/5-fputc.patch
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches/5-fputc.patch')
-rw-r--r--debian/patches/5-fputc.patch24
1 files changed, 24 insertions, 0 deletions
diff --git a/debian/patches/5-fputc.patch b/debian/patches/5-fputc.patch
new file mode 100644
index 0000000..26e9f21
--- /dev/null
+++ b/debian/patches/5-fputc.patch
@@ -0,0 +1,24 @@
+diff --git a/test cases/common/105 generatorcustom/gen.c b/test cases/common/105 generatorcustom/gen.c
+index 59518c0ef..964ae7e9c 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);
+