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

Unified Diff: runtime/bin/socket_macos.cc

Issue 9720045: Extend dart:io error handling to all socket functions (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix Mac OS and Windows compile 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/socket_macos.cc
diff --git a/runtime/bin/socket_macos.cc b/runtime/bin/socket_macos.cc
index 5d5cce86c288d403f3533f7006a4c42ac62f926c..c9b82049ab7d31b0cdd7686bc96586dfb99bab9b 100644
--- a/runtime/bin/socket_macos.cc
+++ b/runtime/bin/socket_macos.cc
@@ -102,6 +102,17 @@ intptr_t Socket::GetPort(intptr_t fd) {
}
+void Socket::GetError(intptr_t fd, OSError* os_error) {
+ int len = sizeof(errno);
+ getsockopt(fd,
+ SOL_SOCKET,
+ SO_ERROR,
+ &errno,
+ reinterpret_cast<socklen_t*>(&len));
+ os_error->SetCodeAndMessage(OSError::kSystem, errno);
+}
+
+
intptr_t Socket::GetStdioHandle(int num) {
return static_cast<intptr_t>(num);
}
@@ -121,8 +132,6 @@ const char* Socket::LookupIPv4Address(char* host, OSError** os_error) {
*os_error = new OSError(status,
gai_strerror(status),
OSError::kGetAddressInfo);
- (*os_error)->set_code(status);
- (*os_error)->SetMessage(gai_strerror(status));
return NULL;
}
// Convert the address into IPv4 dotted decimal notation.

Powered by Google App Engine
This is Rietveld 408576698