incorrect check for fwrite fail (#541)

This commit is contained in:
Dhanya Thattil
2022-08-31 15:53:24 +02:00
committed by GitHub
parent d73d8994c0
commit 4913c9c0b0
2 changed files with 5 additions and 9 deletions

View File

@ -32,8 +32,7 @@ std::string CreateMasterBinaryFile(const std::string &filePath,
rapidjson::StringBuffer s;
rapidjson::PrettyWriter<rapidjson::StringBuffer> writer(s);
attr->GetBinaryAttributes(&writer);
if (fwrite(s.GetString(), 1, strlen(s.GetString()), fd) !=
strlen(s.GetString())) {
if (fwrite(s.GetString(), strlen(s.GetString()), 1, fd) != 1) {
throw RuntimeError(
"Master binary file incorrect number of bytes written to file");
}