Commit 337f5221 authored by Marcin Siodelski's avatar Marcin Siodelski
Browse files

[3687] Pass c-string to the constructor of fstream.

Passing the std::string doesn't work on Linux. For some reason it works
on BSD.
parent 27f9de21
......@@ -14,7 +14,9 @@
#include <util/pid_file.h>
#include <gtest/gtest.h>
#include <fstream>
#include <signal.h>
#include <stdint.h>
namespace {
using namespace isc::util;
......@@ -93,7 +95,7 @@ TEST_F(PIDFileTest, writeAndDelete) {
pid_file.write(10);
// Read the file and compare the pid
fs.open(absolutePath(TESTNAME), std::ifstream::in);
fs.open(absolutePath(TESTNAME).c_str(), std::ifstream::in);
fs >> pid;
EXPECT_TRUE(fs.good());
EXPECT_EQ(pid, 10);
......@@ -103,7 +105,7 @@ TEST_F(PIDFileTest, writeAndDelete) {
pid_file.write(20);
// And comapre the second pid
fs.open(absolutePath(TESTNAME), std::ifstream::in);
fs.open(absolutePath(TESTNAME).c_str(), std::ifstream::in);
fs >> pid;
EXPECT_TRUE(fs.good());
EXPECT_EQ(pid, 20);
......@@ -113,7 +115,7 @@ TEST_F(PIDFileTest, writeAndDelete) {
pid_file.deleteFile();
// And verify that it's gone
fs.open(absolutePath(TESTNAME), std::ifstream::in);
fs.open(absolutePath(TESTNAME).c_str(), std::ifstream::in);
EXPECT_FALSE(fs.good());
fs.close();
}
......@@ -172,7 +174,7 @@ TEST_F(PIDFileTest, pidGarbage) {
std::ofstream fs;
// Open the file and write garbage to it
fs.open(absolutePath(TESTNAME), std::ofstream::out);
fs.open(absolutePath(TESTNAME).c_str(), std::ofstream::out);
fs << "text" << std::endl;
fs.close();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment