[T106][ZXW-22]7520V3SCV2.01.01.02P42U09_VEC_V0.8_AP_VEC origin source commit
Change-Id: Ic6e05d89ecd62fc34f82b23dcf306c93764aec4b
diff --git a/ap/libc/glibc/glibc-2.22/stdio-common/bug3.c b/ap/libc/glibc/glibc-2.22/stdio-common/bug3.c
new file mode 100644
index 0000000..6b2ed6b
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/stdio-common/bug3.c
@@ -0,0 +1,53 @@
+#include <stdio.h>
+#include <string.h>
+
+int
+main (void)
+{
+ FILE *f;
+ int i;
+ const char filename[] = "/tmp/bug3.test";
+
+ f = fopen(filename, "w+");
+ for (i=0; i<9000; i++)
+ putc ('x', f);
+ fseek (f, 8180L, 0);
+ fwrite ("Where does this text go?", 1, 24, f);
+ fflush (f);
+
+ rewind (f);
+ for (i=0; i<9000; i++)
+ {
+ int j;
+
+ if ((j = getc(f)) != 'x')
+ {
+ if (i != 8180)
+ {
+ printf ("Test FAILED!");
+ return 1;
+ }
+ else
+ {
+ char buf[25];
+
+ buf[0] = j;
+ fread (buf + 1, 1, 23, f);
+ buf[24] = '\0';
+ if (strcmp (buf, "Where does this text go?") != 0)
+ {
+ printf ("%s\nTest FAILED!\n", buf);
+ return 1;
+ }
+ i += 23;
+ }
+ }
+ }
+
+ fclose(f);
+ remove(filename);
+
+ puts ("Test succeeded.");
+
+ return 0;
+}