libstdc++: Fix undefined FILE* operations in test
authorJonathan Wakely <jwakely@redhat.com>
Thu, 26 Nov 2020 11:25:55 +0000 (11:25 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Thu, 26 Nov 2020 11:25:55 +0000 (11:25 +0000)
We only need to check that the constructor doesn't clear errno, so
there's no need to use an invalid FILE* for that.

libstdc++-v3/ChangeLog:

PR libstdc++/98001
* testsuite/ext/stdio_filebuf/char/79820.cc: Do not pass invalid
FILE* to constructor.

libstdc++-v3/testsuite/ext/stdio_filebuf/char/79820.cc

index c9842d6d03ed1f6b7f04ff0624a8abbaf7795f40..aaa398c964a5503d4ac31c1f83b91a43aade0547 100644 (file)
@@ -26,10 +26,11 @@ void
 test01()
 {
   FILE* f = std::fopen("79820.txt", "w");
-  std::fclose(f);
   errno = 127;
   __gnu_cxx::stdio_filebuf<char> b(f, std::ios::out, BUFSIZ);
   VERIFY(errno == 127); // PR libstdc++/79820
+  b.close();
+  std::fclose(f);
 }
 
 int