[msan] Fix gethostent tests
authorVitaly Buka <vitalybuka@google.com>
Fri, 25 Sep 2020 08:28:23 +0000 (01:28 -0700)
committerVitaly Buka <vitalybuka@google.com>
Fri, 25 Sep 2020 09:34:49 +0000 (02:34 -0700)
gethostent should follow sethostent.

compiler-rt/lib/msan/tests/msan_test.cpp

index 6306b3d..318a355 100644 (file)
@@ -1114,6 +1114,7 @@ TEST_P(MemorySanitizerIpTest, recvmsg) {
   } while (0)
 
 TEST(MemorySanitizer, gethostent) {
+  sethostent(0);
   struct hostent *he = gethostent();
   ASSERT_NE((void *)NULL, he);
   EXPECT_HOSTENT_NOT_POISONED(he);
@@ -1177,6 +1178,7 @@ TEST(MemorySanitizer, gethostbyaddr) {
 
 #if !defined(__NetBSD__)
 TEST(MemorySanitizer, gethostent_r) {
+  sethostent(0);
   char buf[2000];
   struct hostent he;
   struct hostent *result;