From: Marcin Siodelski Date: Tue, 17 Nov 2015 21:07:00 +0000 (+0100) Subject: [3874] Fixed string type in open() functions. X-Git-Tag: trac4231_base~39^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2a47967c6f4ab9a249f7845a8a3cb4fbda7de2ef;p=thirdparty%2Fkea.git [3874] Fixed string type in open() functions. --- diff --git a/src/lib/dhcp/duid_factory.cc b/src/lib/dhcp/duid_factory.cc index 43e2906ca9..4345f29672 100644 --- a/src/lib/dhcp/duid_factory.cc +++ b/src/lib/dhcp/duid_factory.cc @@ -312,7 +312,7 @@ DUIDFactory::set(const std::vector& duid_vector) { if (isPersisted()) { std::ofstream ofs; try { - ofs.open(storage_location_, std::ofstream::out | + ofs.open(storage_location_.c_str(), std::ofstream::out | std::ofstream::trunc); if (!ofs.good()) { isc_throw(InvalidOperation, "unable to open DUID file " @@ -380,7 +380,7 @@ DUIDFactory::readFromFile() { std::ostringstream duid_str; if (isPersisted()) { std::ifstream ifs; - ifs.open(storage_location_, std::ifstream::in); + ifs.open(storage_location_.c_str(), std::ifstream::in); if (ifs.good()) { std::string read_contents; while (!ifs.eof() && ifs.good()) { diff --git a/src/lib/dhcp/tests/duid_factory_unittest.cc b/src/lib/dhcp/tests/duid_factory_unittest.cc index 7328222202..ede8bca506 100644 --- a/src/lib/dhcp/tests/duid_factory_unittest.cc +++ b/src/lib/dhcp/tests/duid_factory_unittest.cc @@ -167,7 +167,7 @@ DUIDFactoryTest::removeDefaultFile() const { std::string DUIDFactoryTest::readDefaultFile() const { std::ifstream ifs; - ifs.open(absolutePath(DEFAULT_DUID_FILE), std::ifstream::in); + ifs.open(absolutePath(DEFAULT_DUID_FILE).c_str(), std::ifstream::in); if (!ifs.good()) { return (std::string()); }