0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 00:56:44 +01:00

truncate lock file SERVER-504

This commit is contained in:
Eliot Horowitz 2009-12-22 07:26:28 -05:00
parent 7c005a3fee
commit 566603ad8b

View File

@ -722,7 +722,7 @@ namespace mongo {
void acquirePathLock() {
#if !defined(_WIN32) && !defined(__sunos__)
string name = ( boost::filesystem::path( dbpath ) / "mongod.lock" ).native_file_string();
lockFile = open( name.c_str(), O_RDWR | O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO );
lockFile = open( name.c_str(), O_RDWR | O_CREAT | O_TRUNC, S_IRWXU | S_IRWXG | S_IRWXO );
massert( "Unable to create / open lock file for dbpath: " + name, lockFile > 0 );
massert( "Unable to acquire lock for dbpath: " + name, flock( lockFile, LOCK_EX | LOCK_NB ) == 0 );