diff options
author | Kyle Erf <erf@mongodb.com> | 2013-09-19 14:15:17 -0400 |
---|---|---|
committer | Matt Kangas <matt.kangas@mongodb.com> | 2013-09-27 16:53:16 -0400 |
commit | 8a2181ba012c8d28faeb5f5dd56cc7e19ae4ec56 (patch) | |
tree | 9ed3c10a3fed9917c7a4c83c64e4d80ea52eef12 /src/mongo/util/processinfo.cpp | |
parent | b3616bea4afb813427f601764c65f1e291f82a6e (diff) | |
download | mongo-8a2181ba012c8d28faeb5f5dd56cc7e19ae4ec56.tar.gz |
SERVER-10034 Invalid --pidfilepath no longer silently ignored
Signed-off-by: Matt Kangas <matt.kangas@mongodb.com>
Diffstat (limited to 'src/mongo/util/processinfo.cpp')
-rw-r--r-- | src/mongo/util/processinfo.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/mongo/util/processinfo.cpp b/src/mongo/util/processinfo.cpp index 21057de9863..fd18180c743 100644 --- a/src/mongo/util/processinfo.cpp +++ b/src/mongo/util/processinfo.cpp @@ -34,18 +34,23 @@ namespace mongo { out.close(); } - void write( const string& p ) { + bool write( const string& p ) { path = p; ofstream out( path.c_str() , ios_base::out ); out << ProcessId::getCurrent() << endl; - out.close(); + return out; } string path; } pidFileWiper; - void writePidFile( const string& path ) { - pidFileWiper.write( path ); + bool writePidFile( const string& path ) { + bool e = pidFileWiper.write( path ); + if (!e) { + log() << "ERROR: Cannot write pid file to " << path + << ": "<< strerror(errno); + } + return e; } ProcessInfo::SystemInfo* ProcessInfo::systemInfo = NULL; |