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

Unified Diff: runtime/bin/file_macos.cc

Issue 9630012: Error reporting on File in dart:io (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Made Dart OSError constructor const Created 8 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 9b7093daff51e3fe6336ad217173c90e1ee9c5e3..707335f688f7ae19488af87362cd07e0526b42ea 100644
--- a/runtime/bin/file_macos.cc
+++ b/runtime/bin/file_macos.cc
@@ -105,7 +105,7 @@ off_t File::Length() {
}
-File* File::Open(const char* name, FileOpenMode mode) {
+File* File::Open(const char* name, FileOpenMode mode, OSError* os_error) {
int flags = O_RDONLY;
if ((mode & kWrite) != 0) {
flags = (O_RDWR | O_CREAT);
@@ -115,6 +115,10 @@ File* File::Open(const char* name, FileOpenMode mode) {
}
int fd = TEMP_FAILURE_RETRY(open(name, flags, 0666));
if (fd < 0) {
+ if (os_error != NULL) {
+ os_error->set_code(errno);
+ os_error->SetMessage(strerror(errno));
+ }
return NULL;
}
if (((mode & kWrite) != 0) && ((mode & kTruncate) == 0)) {

Powered by Google App Engine
This is Rietveld 408576698