Skip to content

Commit

Permalink
check the failbit after closing the datastore file
Browse files Browse the repository at this point in the history
This is per the documentation <https://www.cplusplus.com/reference/fstream/ofstream/close/> that indicates that the failbit is set if close fails.
  • Loading branch information
adam-p committed Nov 9, 2021
1 parent 64bf896 commit e2562ee
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions datastore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,10 @@ static Error FileStore(int transaction_depth, const string& file_path, const jso

f.close();

if (f.fail()) {
return MakeCriticalError(utils::Stringer("temp_file_path close failed; errno=", errno));
}

/*
Rename temp to commit
*/
Expand Down

0 comments on commit e2562ee

Please sign in to comment.