It turns out that when passing a closed file to getdelim or getline, the
functions in glibc will properly return a failure, but errno might not be
set. Skip the errno check except on bionic.
Change-Id: I8d625f15303d4c2d42e8d28491ea8a368aea4d32
fclose(fp);
errno = 0;
ASSERT_EQ(getdelim(&buffer, &buffer_length, ' ', fp), -1);
+ // glibc sometimes doesn't set errno in this particular case.
+#if defined(__BIONIC__)
ASSERT_EQ(EBADF, errno);
+#endif
}
TEST(stdio, getline) {
fclose(fp);
errno = 0;
ASSERT_EQ(getline(&buffer, &buffer_length, fp), -1);
+ // glibc sometimes doesn't set errno in this particular case.
+#if defined(__BIONIC__)
ASSERT_EQ(EBADF, errno);
+#endif
}
TEST(stdio, printf_ssize_t) {