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

Unified Diff: runtime/bin/file_macos.cc

Issue 12476021: Handle /dev/null on linux, as an closed device. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Apply same fix for mac Created 7 years, 9 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: runtime/bin/file_macos.cc
diff --git a/runtime/bin/file_macos.cc b/runtime/bin/file_macos.cc
index 920d01f230896bd41fee5744f4582d0f4ad4dfd2..7506cbfbb260ac066bf8121c51c533dbf853d369 100644
--- a/runtime/bin/file_macos.cc
+++ b/runtime/bin/file_macos.cc
@@ -109,7 +109,8 @@ File* File::Open(const char* name, FileOpenMode mode) {
// Report errors for non-regular files.
struct stat st;
if (TEMP_FAILURE_RETRY(stat(name, &st)) == 0) {
- if (!S_ISREG(st.st_mode)) {
+ // Only accept regular files and character devices.
+ if (!S_ISREG(st.st_mode) && !S_ISCHR(st.st_mode)) {
errno = (S_ISDIR(st.st_mode)) ? EISDIR : ENOENT;
return NULL;
}

Powered by Google App Engine
This is Rietveld 408576698