diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-17 17:50:40 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-17 17:50:40 +0000 |
commit | d8e148382edd20b943e059374f847c394f368f53 (patch) | |
tree | e18235fb24f04e7802396017fe0ef2af200acb31 /chrome/browser/privacy_blacklist | |
parent | 9614d59445acc7d2d0f2159f7cf0d1a538a012dd (diff) | |
download | chromium_src-d8e148382edd20b943e059374f847c394f368f53.zip chromium_src-d8e148382edd20b943e059374f847c394f368f53.tar.gz chromium_src-d8e148382edd20b943e059374f847c394f368f53.tar.bz2 |
Silence compile errors on some compilers by checking return value of fwrite.
hat tip to spotrh
BUG=16948
TEST=none
Review URL: http://codereview.chromium.org/149786
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20966 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/privacy_blacklist')
-rw-r--r-- | chrome/browser/privacy_blacklist/blacklist_store.cc | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/chrome/browser/privacy_blacklist/blacklist_store.cc b/chrome/browser/privacy_blacklist/blacklist_store.cc index ba3784d..2139db2 100644 --- a/chrome/browser/privacy_blacklist/blacklist_store.cc +++ b/chrome/browser/privacy_blacklist/blacklist_store.cc @@ -8,6 +8,7 @@ #include "base/basictypes.h" #include "base/file_util.h" +#include "base/logging.h" namespace { @@ -16,17 +17,25 @@ const char cookie[] = "GCPBL100"; } void BlacklistStoreOutput::WriteUInt(uint32 i) { - fwrite(reinterpret_cast<char*>(&i), 1, sizeof(uint32), file_); + if (fwrite(reinterpret_cast<char*>(&i), 1, sizeof(uint32), file_) != + sizeof(uint32)) { + LOG(ERROR) << "fwrite failed to write uint32"; + } } void BlacklistStoreOutput::WriteString(const std::string& s) { uint32 n = s.size(); - fwrite(reinterpret_cast<char*>(&n), 1, sizeof(uint32), file_); - fwrite(s.c_str(), 1, s.size(), file_); + if (fwrite(reinterpret_cast<char*>(&n), 1, sizeof(uint32), file_) != + sizeof(uint32)) { + LOG(ERROR) << "fwrite failed to write string size"; + } + if (fwrite(s.c_str(), 1, s.size(), file_) != s.size()) + LOG(ERROR) << "fwrite failed to write string data"; } BlacklistStoreOutput::BlacklistStoreOutput(FILE* file) : file_(file) { - fwrite(cookie, 1, sizeof(cookie), file_); + if (fwrite(cookie, 1, sizeof(cookie), file_) != sizeof(cookie)) + LOG(ERROR) << "fwrite failed to write cookie"; } BlacklistStoreOutput::~BlacklistStoreOutput() { |