Add __fseterr.

Trivial, obvious counterpart to the standard ferror(3) and clearerr(3),
and lets us build bison out of the box.

Bug: http://b/64273806
Test: ran tests
Change-Id: I20affabddb71210051165c41e86adfe5ae04f77f
diff --git a/tests/stdio_ext_test.cpp b/tests/stdio_ext_test.cpp
index 128e255..849bf0b 100644
--- a/tests/stdio_ext_test.cpp
+++ b/tests/stdio_ext_test.cpp
@@ -190,6 +190,22 @@
   }
 }
 
+TEST(stdio_ext, __fseterr) {
+#if defined(__GLIBC__)
+  GTEST_LOG_(INFO) << "glibc doesn't have __fseterr, but gnulib will use it";
+#else
+  FILE* fp = fopen("/dev/null", "w");
+
+  ASSERT_FALSE(ferror(fp));
+  __fseterr(fp);
+  ASSERT_TRUE(ferror(fp));
+  clearerr(fp);
+  ASSERT_FALSE(ferror(fp));
+
+  fclose(fp);
+#endif
+}
+
 TEST(stdio_ext, __fsetlocking) {
   FILE* fp = fopen("/proc/version", "r");
   ASSERT_EQ(FSETLOCKING_INTERNAL, __fsetlocking(fp, FSETLOCKING_QUERY));