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

Unified Diff: runtime/bin/file_linux.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
« no previous file with comments | « runtime/bin/eventhandler_macos.cc ('k') | runtime/bin/file_macos.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/file_linux.cc
diff --git a/runtime/bin/file_linux.cc b/runtime/bin/file_linux.cc
index ce0ef27bb26c5ea84f21e13424b345098c4d2f4e..73b0912053582b12f1217b3a3d505cb6f3fb9857 100644
--- a/runtime/bin/file_linux.cc
+++ b/runtime/bin/file_linux.cc
@@ -107,7 +107,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;
}
@@ -122,6 +123,7 @@ File* File::Open(const char* name, FileOpenMode mode) {
flags |= O_CLOEXEC;
int fd = TEMP_FAILURE_RETRY(open(name, flags, 0666));
if (fd < 0) {
+ printf("Open failed\n");
Søren Gjesse 2013/03/11 15:08:16 Debug print.
Anders Johnsen 2013/06/11 12:14:41 Done.
return NULL;
}
if (((mode & kWrite) != 0) && ((mode & kTruncate) == 0)) {
« no previous file with comments | « runtime/bin/eventhandler_macos.cc ('k') | runtime/bin/file_macos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698