Skip to content

Commit

Permalink
Make dead code into less dead code. (#417)
Browse files Browse the repository at this point in the history
* Make dead code into less dead code.

* fix code style.

* remove superfluous space.
  • Loading branch information
bakerstu authored Aug 9, 2020
1 parent 844b467 commit 5c2b3a0
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/utils/FileUtils.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,15 @@ void write_string_to_file(const string &filename, const string &data)
while ((nr = fwrite(data.data() + offset, 1, data.size() - offset, f)) > 0)
{
offset += nr;
if (offset >= data.size()) break;
if (offset >= data.size())
{
break;
}
}
if (nr < 0) {
fprintf(stderr, "error writing: %s\n", strerror(errno));
if (offset != data.size())
{
fprintf(stderr, "error writing: %s, offset: %zu, size: %zu\n",
strerror(errno), offset, data.size());
}
fclose(f);
}
Expand Down

0 comments on commit 5c2b3a0

Please sign in to comment.