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

Unified Diff: base/files/file_util_win.cc

Issue 1350493002: Check for CloseHandle failures even when not debugging (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code tweaks Created 5 years, 3 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 | base/memory/shared_memory_win.cc » ('j') | base/memory/shared_memory_win.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/files/file_util_win.cc
diff --git a/base/files/file_util_win.cc b/base/files/file_util_win.cc
index e254232f66305910e0bd64d0f2c7ab71b5e3fac2..071ff1f73940328e81caa1515984b623fcb37dd0 100644
--- a/base/files/file_util_win.cc
+++ b/base/files/file_util_win.cc
@@ -231,14 +231,13 @@ bool PathExists(const FilePath& path) {
bool PathIsWritable(const FilePath& path) {
ThreadRestrictions::AssertIOAllowed();
- HANDLE dir =
+ win::ScopedHandle dir(
CreateFile(path.value().c_str(), FILE_ADD_FILE, kFileShareAll,
- NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
+ NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL));
- if (dir == INVALID_HANDLE_VALUE)
+ if (!dir.IsValid())
rvargas (doing something else) 2015/09/16 02:09:12 nit: return dir.IsValid();
brucedawson 2015/09/16 18:29:00 D'oh! Of course.
return false;
- CloseHandle(dir);
return true;
}
« no previous file with comments | « no previous file | base/memory/shared_memory_win.cc » ('j') | base/memory/shared_memory_win.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698