diff options
author | Andreas Schuh <andreas.schuh.84@gmail.com> | 2014-03-17 21:19:35 +0000 |
---|---|---|
committer | Andreas Schuh <andreas.schuh.84@gmail.com> | 2014-03-17 21:19:35 +0000 |
commit | 8d3797cd15371328c8e0fc5f71060fb9ad4e40c7 (patch) | |
tree | b4cb2554442ada0ff31ce27a199daaf76586efa1 /test | |
parent | 8d93bca20a0700c81fadda5849cb73d7be8d91ba (diff) | |
download | gflags-8d3797cd15371328c8e0fc5f71060fb9ad4e40c7.tar.gz gflags-8d3797cd15371328c8e0fc5f71060fb9ad4e40c7.tar.bz2 gflags-8d3797cd15371328c8e0fc5f71060fb9ad4e40c7.zip |
Fix VS security warnings using SafeGetEnv and SafeFOpen utility functions.
Diffstat (limited to 'test')
-rw-r--r-- | test/gflags_unittest.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/test/gflags_unittest.cc b/test/gflags_unittest.cc index 4990182..185d562 100644 --- a/test/gflags_unittest.cc +++ b/test/gflags_unittest.cc @@ -1098,7 +1098,8 @@ TEST(DeprecatedFunctionsTest, AppendFlagsIntoFile) { const bool r = AppendFlagsIntoFile(filename, "not the real argv0"); EXPECT_TRUE(r); - FILE* fp = fopen(filename.c_str(), "r"); + FILE* fp; + EXPECT_EQ(0, SafeFOpen(&fp, filename.c_str(), "r")); EXPECT_TRUE(fp != NULL); char line[8192]; EXPECT_TRUE(fgets(line, sizeof(line)-1, fp) != NULL); // get the first line @@ -1134,7 +1135,8 @@ TEST(DeprecatedFunctionsTest, ReadFromFlagsFile) { TEST(DeprecatedFunctionsTest, ReadFromFlagsFileFailure) { FLAGS_test_int32 = -20; string filename(TmpFile("flagfile3")); - FILE* fp = fopen(filename.c_str(), "w"); + FILE* fp; + EXPECT_EQ(0, SafeFOpen(&fp, filename.c_str(), "w")); EXPECT_TRUE(fp != NULL); // Note the error in the bool assignment below... fprintf(fp, "%s\n--test_int32=-21\n--test_bool=not_a_bool!\n", GetArgv0()); |