From 9f2399e918abfc2b4d1ca0cb6153e552bf5a3eb9 Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Thu, 17 Jan 2013 22:25:57 +0000 Subject: [PATCH] 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 --- tests/cefclient/client_handler.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/cefclient/client_handler.cpp b/tests/cefclient/client_handler.cpp index 48fddea3b..2b3e24d0d 100644 --- a/tests/cefclient/client_handler.cpp +++ b/tests/cefclient/client_handler.cpp @@ -636,7 +636,13 @@ bool ClientHandler::Save(const std::string& path, const std::string& data) { FILE* f = fopen(path.c_str(), "w"); if (!f) 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); return true; }