Skip to content

Commit

Permalink
Use more-complete file open flags
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-p committed Sep 23, 2019
1 parent 88fafa1 commit a219b20
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions datastore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ Error Datastore::FileLoad(const string& file_path) {
json_ = json::object();

ifstream f;
f.open(file_path, ios::binary);
f.open(file_path, ios::in | ios::binary);

// Figuring out the cause of an open-file problem (i.e., file doesn't exist vs. filesystem is
// broken) is annoying difficult to do robustly and in a cross-platform manner.
Expand Down Expand Up @@ -124,7 +124,7 @@ Error Datastore::FileStore(const string& file_path) {
}

ofstream f;
f.open(file_path, ios::trunc | ios::binary);
f.open(file_path, ios::out | ios::trunc | ios::binary);
if (!f.is_open()) {
return MakeCriticalError(utils::Stringer("not f.is_open; errno=", errno));
}
Expand Down

0 comments on commit a219b20

Please sign in to comment.