Commit f924eff4 authored by paivanof@gmail.com's avatar paivanof@gmail.com

Fix error checking in VisitedLinkMaster.

Avoid crashes when visited links database cannot be opened.

BUG=61102, 141044

Review URL: https://chromiumcodereview.appspot.com/10826297

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@151870 0039d316-1c4b-4281-b951-d872f2087c98
parent 318ee398
......@@ -94,6 +94,7 @@ static bool WriteToFile(FILE* file,
// is used because file may still not be opened by the time of scheduling
// the task for execution.
void AsyncWrite(FILE** file, int32 offset, const std::string& data) {
if (*file)
WriteToFile(*file, offset, data.data(), data.size());
}
......@@ -101,6 +102,7 @@ void AsyncWrite(FILE** file, int32 offset, const std::string& data) {
// thread. Double pointer to FILE is used because file may still not be opened
// by the time of scheduling the task for execution.
void AsyncTruncate(FILE** file) {
if (*file)
base::IgnoreResult(TruncateFile(*file));
}
......@@ -108,6 +110,7 @@ void AsyncTruncate(FILE** file) {
// of FILE* value. Double pointer to FILE is used because file may still not
// be opened by the time of scheduling the task for execution.
void AsyncClose(FILE** file) {
if (*file)
base::IgnoreResult(fclose(*file));
free(file);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment