summaryrefslogtreecommitdiff
path: root/src/mongo/logger
diff options
context:
space:
mode:
authorMark Benvenuto <mark.benvenuto@mongodb.com>2016-09-16 14:46:11 -0400
committerMark Benvenuto <mark.benvenuto@mongodb.com>2016-09-16 14:46:11 -0400
commitf0d958c747cfc42dd831eb2f088e963475c0ed54 (patch)
tree39cac193f0b58c9d95c3774fb4964259975e840b /src/mongo/logger
parent3174e2d67d077fa8362c3f1200024d69773344fd (diff)
downloadmongo-f0d958c747cfc42dd831eb2f088e963475c0ed54.tar.gz
SERVER-16725 Incorrect character conversion between UTF-8 and UTF-16
Diffstat (limited to 'src/mongo/logger')
-rw-r--r--src/mongo/logger/rotatable_file_writer.cpp24
1 files changed, 4 insertions, 20 deletions
diff --git a/src/mongo/logger/rotatable_file_writer.cpp b/src/mongo/logger/rotatable_file_writer.cpp
index 4c053f19615..9a5e1395c96 100644
--- a/src/mongo/logger/rotatable_file_writer.cpp
+++ b/src/mongo/logger/rotatable_file_writer.cpp
@@ -187,21 +187,6 @@ Win32FileStreambuf::int_type Win32FileStreambuf::overflow(int_type ch) {
return traits_type::eof();
}
-// Win32 implementation of renameFile that handles non-ascii file names.
-int renameFile(const std::string& oldName, const std::string& newName) {
- return _wrename(utf8ToWide(oldName).c_str(), utf8ToWide(newName).c_str());
-}
-
-} // namespace
-#else
-
-namespace {
-
-// *nix implementation of renameFile that assumes the OS is encoding file names in UTF-8.
-int renameFile(const std::string& oldName, const std::string& newName) {
- return rename(oldName.c_str(), newName.c_str());
-}
-
} // namespace
#endif
@@ -239,17 +224,16 @@ Status RotatableFileWriter::Use::rotate(bool renameOnRotate, const std::string&
<< e.what());
}
- if (0 != renameFile(_writer->_fileName, renameTarget)) {
+ boost::system::error_code ec;
+ boost::filesystem::rename(_writer->_fileName, renameTarget, ec);
+ if (ec) {
return Status(ErrorCodes::FileRenameFailed,
mongoutils::str::stream() << "Failed to rename \""
<< _writer->_fileName
<< "\" to \""
<< renameTarget
<< "\": "
- << strerror(errno)
- << " ("
- << errno
- << ')');
+ << ec.message());
// TODO(schwerin): Make errnoWithDescription() available in the logger library, and
// use it here.
}