Should probably make sure this succeeds.

This commit is contained in:
Jordan Bancino 2022-11-23 00:44:29 +00:00
parent fb56c3fca6
commit 520b062dbb

View file

@ -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);