mirror of
https://github.com/Ylianst/MeshAgent
synced 2026-01-02 00:23:17 +00:00
Fixed race condition, where on Linux when you compact the DB, it may not unlock before it reopens
This commit is contained in:
@@ -617,6 +617,9 @@ __EXPORT_TYPE int ILibSimpleDataStore_Compact(ILibSimpleDataStore dataStore)
|
|||||||
if (root->error == 0)
|
if (root->error == 0)
|
||||||
{
|
{
|
||||||
// Success in writing new temporary file
|
// Success in writing new temporary file
|
||||||
|
#ifdef _POSIX
|
||||||
|
flock(fileno(root->dataFile), LOCK_UN);
|
||||||
|
#endif
|
||||||
fclose(root->dataFile); // Close the data store
|
fclose(root->dataFile); // Close the data store
|
||||||
fclose(compacted); // Close the temporary data store
|
fclose(compacted); // Close the temporary data store
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user