diff options
Diffstat (limited to 'src/mongo/db/storage/storage_engine_lock_file_windows.cpp')
-rw-r--r-- | src/mongo/db/storage/storage_engine_lock_file_windows.cpp | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/src/mongo/db/storage/storage_engine_lock_file_windows.cpp b/src/mongo/db/storage/storage_engine_lock_file_windows.cpp index 64d79c00ce7..72abd6a68bf 100644 --- a/src/mongo/db/storage/storage_engine_lock_file_windows.cpp +++ b/src/mongo/db/storage/storage_engine_lock_file_windows.cpp @@ -38,7 +38,6 @@ #include <ostream> #include <sstream> -#include "mongo/platform/process_id.h" #include "mongo/util/log.h" #include "mongo/util/str.h" #include "mongo/util/text.h" @@ -151,10 +150,10 @@ void StorageEngineLockFile::close() { _lockFileHandle->clear(); } -Status StorageEngineLockFile::writePid() { +Status StorageEngineLockFile::writeString(StringData str) { if (!_lockFileHandle->isValid()) { return Status(ErrorCodes::FileNotOpen, - str::stream() << "Unable to write process ID to " << _filespec + str::stream() << "Unable to write string to " << _filespec << " because file has not been opened."); } @@ -163,27 +162,21 @@ Status StorageEngineLockFile::writePid() { return status; } - ProcessId pid = ProcessId::getCurrent(); - std::stringstream ss; - ss << pid << std::endl; - std::string pidStr = ss.str(); DWORD bytesWritten = 0; if (::WriteFile(_lockFileHandle->_handle, - static_cast<LPCVOID>(pidStr.c_str()), - static_cast<DWORD>(pidStr.size()), + static_cast<LPCVOID>(str.rawData()), + static_cast<DWORD>(str.size()), &bytesWritten, NULL) == FALSE) { int errorcode = GetLastError(); return Status(ErrorCodes::FileStreamFailed, - str::stream() << "Unable to write process id " << pid.toString() - << " to file: " + str::stream() << "Unable to write string " << str << " to file: " << _filespec << ' ' << errnoWithDescription(errorcode)); } else if (bytesWritten == 0) { return Status(ErrorCodes::FileStreamFailed, - str::stream() << "Unable to write process id " << pid.toString() - << " to file: " + str::stream() << "Unable to write string " << str << " to file: " << _filespec << " no data written."); } |