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

Unified Diff: base/file_util_win.cc

Issue 541022: Fix the case where the browser livelocks if we cannot open a file. (Closed)
Patch Set: Created 10 years, 11 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
Index: base/file_util_win.cc
diff --git a/base/file_util_win.cc b/base/file_util_win.cc
index 9133e7b5296ba6b7244e6b30d761adfee3a9d0b4..9def1a5dfdcdc527a3ec973f67d7482dd37edf78 100644
--- a/base/file_util_win.cc
+++ b/base/file_util_win.cc
@@ -216,6 +216,19 @@ bool PathExists(const FilePath& path) {
return (GetFileAttributes(path.value().c_str()) != INVALID_FILE_ATTRIBUTES);
}
+bool PathIsReadable(const FilePath& path) {
+ HANDLE dir =
+ CreateFile(path.value().c_str(), FILE_READ_DATA,
wtc 2010/01/12 19:51:02 I'm surprised that we have to test if a file is re
agl 2010/01/25 14:14:09 Ah, _access looks good. I've switched to using tha
+ FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
+ NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
+
+ if (dir == INVALID_HANDLE_VALUE)
+ return false;
+
+ CloseHandle(dir);
+ return true;
+}
+
bool PathIsWritable(const FilePath& path) {
HANDLE dir =
CreateFile(path.value().c_str(), FILE_ADD_FILE,

Powered by Google App Engine
This is Rietveld 408576698