From afe23e7f106461b9aacf913eb49547fe6bf5c148 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Tue, 30 Mar 2021 10:41:12 -0700 Subject: [PATCH] Don't call fileno on NULL file in tests (#2196) --- test/os-test.cc | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/test/os-test.cc b/test/os-test.cc index d9d094ce..57a170a8 100644 --- a/test/os-test.cc +++ b/test/os-test.cc @@ -267,21 +267,7 @@ TEST(BufferedFileTest, CloseError) { } TEST(BufferedFileTest, Fileno) { - buffered_file f; -# ifndef __COVERITY__ - // fileno on a null FILE pointer either crashes or returns an error. - // Disable Coverity because this is intentional. - EXPECT_DEATH_IF_SUPPORTED( - { - try { - f.fileno(); - } catch (const fmt::system_error&) { - std::exit(1); - } - }, - ""); -# endif - f = open_buffered_file(); + auto f = open_buffered_file(); EXPECT_TRUE(f.fileno() != -1); file copy = file::dup(f.fileno()); EXPECT_READ(copy, FILE_CONTENT);