forked from lda/telodendria
Should probably make sure this succeeds.
This commit is contained in:
parent
fb56c3fca6
commit
520b062dbb
1 changed files with 5 additions and 1 deletions
6
src/Db.c
6
src/Db.c
|
@ -563,7 +563,11 @@ DbUnlock(Db * db, DbRef * ref)
|
|||
pthread_mutex_lock(&db->lock);
|
||||
|
||||
rewind(ref->fp);
|
||||
ftruncate(fileno(ref->fp), 0);
|
||||
if (ftruncate(fileno(ref->fp), 0) < 0)
|
||||
{
|
||||
pthread_mutex_unlock(&db->lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
JsonEncode(ref->json, ref->fp);
|
||||
|
||||
|
|
Loading…
Reference in a new issue