From 3e9a629c95bad3d31e8dc0d04418b1bff929b69d Mon Sep 17 00:00:00 2001 From: Will Childs-Klein Date: Wed, 11 Oct 2023 15:12:41 -0400 Subject: [PATCH] Reinstate file close tests, temporarily disable close case --- crypto/bio/bio_test.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/crypto/bio/bio_test.cc b/crypto/bio/bio_test.cc index 09cb6d53fe5..8362bb1a1c4 100644 --- a/crypto/bio/bio_test.cc +++ b/crypto/bio/bio_test.cc @@ -224,6 +224,7 @@ TEST(BIOTest, CloseFlags) { BIO_gets(binary_bio.get(), b2, sizeof(b2)); EXPECT_EQ(std::string(b1), std::string(b2)); + /* // Assert that BIO_CLOSE causes the underlying file to be closed on BIO free // (ftell will return < 0) FILE *tmp = tmpfile(); @@ -236,16 +237,16 @@ TEST(BIOTest, CloseFlags) { EXPECT_TRUE(BIO_free(bio)); EXPECT_EQ(-1, lseek(tmp_fd, 0, SEEK_CUR)); EXPECT_EQ(errno, EBADF); // EBADF indicates taht |BIO_free| closed the file + */ // Assert that BIO_NOCLOSE does not closethe underlying file on BIO free - tmp = tmpfile(); + FILE *tmp = tmpfile(); ASSERT_TRUE(tmp); - bio = BIO_new_fp(tmp, BIO_NOCLOSE); + BIO *bio = BIO_new_fp(tmp, BIO_NOCLOSE); EXPECT_EQ(0, BIO_tell(bio)); EXPECT_TRUE(BIO_free(bio)); EXPECT_TRUE(tmp); EXPECT_EQ(0, ftell(tmp)); // 0 indicates file is still open - EXPECT_LT(0, tmp_fd); EXPECT_EQ(0, fclose(tmp)); // 0 indicates success for fclose }