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

Unified Diff: base/file_util_win.cc

Issue 296933016: Avoid trying to delete a non-existent file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | content/browser/download/base_file.cc » ('j') | content/browser/download/base_file.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/file_util_win.cc
diff --git a/base/file_util_win.cc b/base/file_util_win.cc
index adf6608f4e3f16e32238fb46c6b2ae2cbaa5fc04..dce906313a2b78343632b787fb9edad56b3755c9 100644
--- a/base/file_util_win.cc
+++ b/base/file_util_win.cc
@@ -68,6 +68,12 @@ bool DeleteFile(const FilePath& path, bool recursive) {
// to SHFileOperation, which will do the right thing.
if (::DeleteFile(path.value().c_str()) != 0)
return true;
+
+ // If the file doesn't exist, then we are done. This is belt-and-suspenders
+ // for avoiding a SHFileOperation() call on a non-existent file. See
+ // http://crbug.com/368455.
+ if (!PathExists(path))
+ return true;
}
// SHFILEOPSTRUCT wants the path to be terminated with two NULLs,
« no previous file with comments | « no previous file | content/browser/download/base_file.cc » ('j') | content/browser/download/base_file.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698