Bug #691
- Fixed bug #691, which was a mis-reporting of file lock state even when file locking was turned off (thanks to Tom Duffy).
This commit is contained in:
@@ -1597,8 +1597,9 @@ FILE* TDB::openAndLock (const std::string& file)
|
||||
throw std::string ("Could not open '") + file + "'.";
|
||||
|
||||
// Lock if desired. Try three times before failing.
|
||||
int retry = 0;
|
||||
if (mLock)
|
||||
{
|
||||
int retry = 0;
|
||||
while (flock (fileno (in), LOCK_NB | LOCK_EX) && ++retry <= 3)
|
||||
{
|
||||
std::cout << "Waiting for file lock...\n";
|
||||
@@ -1606,8 +1607,9 @@ FILE* TDB::openAndLock (const std::string& file)
|
||||
delay (0.2);
|
||||
}
|
||||
|
||||
if (retry > 3)
|
||||
throw std::string ("Could not lock '") + file + "'.";
|
||||
if (retry > 3)
|
||||
throw std::string ("Could not lock '") + file + "'.";
|
||||
}
|
||||
|
||||
return in;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user