Linux: Fix compile error due to fwrite() and warn_unused_result.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1017 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2013-01-17 22:25:57 +00:00
parent 8f95df96c7
commit 9f2399e918
1 changed files with 7 additions and 1 deletions

View File

@ -636,7 +636,13 @@ bool ClientHandler::Save(const std::string& path, const std::string& data) {
FILE* f = fopen(path.c_str(), "w"); FILE* f = fopen(path.c_str(), "w");
if (!f) if (!f)
return false; return false;
fwrite(data.c_str(), data.size(), 1, f); size_t total = 0;
do {
size_t write = fwrite(data.c_str() + total, 1, data.size() - total, f);
if (write == 0)
break;
total += write;
} while (total < data.size());
fclose(f); fclose(f);
return true; return true;
} }