[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/tst-ferror.c b/ap/libc/glibc/glibc-2.22/stdio-common/tst-ferror.c
new file mode 100644
index 0000000..5f23002
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/stdio-common/tst-ferror.c
@@ -0,0 +1,41 @@
+#include <stdio.h>
+
+int
+main (int argc, char *argv[])
+{
+  char buf[100];
+  int result = 0;
+
+  if (ferror (stdin) != 0)
+    {
+      fputs ("error bit set for stdin at startup\n", stdout);
+      result = 1;
+    }
+  if (fgets (buf, sizeof buf, stdin) != buf)
+    {
+      fputs ("fgets with existing input has problem\n", stdout);
+      result = 1;
+    }
+  if (ferror (stdin) != 0)
+    {
+      fputs ("error bit set for stdin after setup\n", stdout);
+      result = 1;
+    }
+  if (fputc ('a', stdin) != EOF)
+    {
+      fputs ("fputc to stdin does not terminate with an error\n", stdout);
+      result = 1;
+    }
+  if (ferror (stdin) == 0)
+    {
+      fputs ("error bit not set for stdin after fputc\n", stdout);
+      result = 1;
+    }
+  clearerr (stdin);
+  if (ferror (stdin) != 0)
+    {
+      fputs ("error bit set for stdin after clearerr\n", stdout);
+      result = 1;
+    }
+  return result;
+}