Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(285)

Unified Diff: webkit/fileapi/file_system_usage_cache.cc

Issue 10832316: Handle invalid usage cache file path (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix indent Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/fileapi/file_system_usage_cache.cc
diff --git a/webkit/fileapi/file_system_usage_cache.cc b/webkit/fileapi/file_system_usage_cache.cc
index 73f4cbed60881f53c05e8c71e6da706a4a0e81e6..f122378548122555656d8b1e35dd4655e6b1c1a8 100644
--- a/webkit/fileapi/file_system_usage_cache.cc
+++ b/webkit/fileapi/file_system_usage_cache.cc
@@ -130,9 +130,9 @@ int64 FileSystemUsageCache::Read(const FilePath& usage_file_path,
uint32* dirty) {
char buffer[kUsageFileSize];
const char *header;
- DCHECK(!usage_file_path.empty());
- if (kUsageFileSize !=
- file_util::ReadFile(usage_file_path, buffer, kUsageFileSize))
+ if (usage_file_path.empty() ||
+ kUsageFileSize != file_util::ReadFile(usage_file_path,
+ buffer, kUsageFileSize))
return -1;
Pickle read_pickle(buffer, kUsageFileSize);
PickleIterator iter(read_pickle);
@@ -164,9 +164,9 @@ int FileSystemUsageCache::Write(const FilePath& usage_file_path,
write_pickle.WriteUInt32(dirty);
write_pickle.WriteInt64(fs_usage);
- DCHECK(!usage_file_path.empty());
FilePath temporary_usage_file_path;
- if (!file_util::CreateTemporaryFileInDir(usage_file_path.DirName(),
+ if (usage_file_path.empty() ||
+ !file_util::CreateTemporaryFileInDir(usage_file_path.DirName(),
&temporary_usage_file_path)) {
return -1;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698