• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include <fcntl.h>
2 #include <gtest/gtest.h>
3 #define _LARGEFILE64_SOURCE
4 #include <fortify/fcntl.h>
5 
6 using namespace testing::ext;
7 
8 class FortifyOpen64chkTest : public testing::Test {
SetUp()9     void SetUp() override {}
TearDown()10     void TearDown() override {}
11 };
12 
13 /**
14  * @tc.name: __open64_chk_001
15  * @tc.desc: Verify if the __open64_chk is functioning properly.
16  * @tc.type: FUNC
17  * */
18 HWTEST_F(FortifyOpen64chkTest, __open64_chk_001, TestSize.Level1)
19 {
20     int fd = __open64_chk("/proc/version", O_RDWR);
21     EXPECT_NE(-1, fd);
22     fd = open64("/proc/version", O_RDWR | O_CREAT, 0777);
23     EXPECT_NE(-1, fd);
24     close(fd);
25 }