Index: runtime/bin/socket_linux.cc |
diff --git a/runtime/bin/socket_linux.cc b/runtime/bin/socket_linux.cc |
index 9d89f35de0a4ba12ba44c294b9d6b4cea853ae2d..db7704b211e3a2d47e29d38c32678992bfbef3b3 100644 |
--- a/runtime/bin/socket_linux.cc |
+++ b/runtime/bin/socket_linux.cc |
@@ -20,6 +20,7 @@ |
#include "bin/log.h" |
#include "bin/signal_blocker.h" |
#include "bin/socket.h" |
+#include "vm/thread.h" |
namespace dart { |
@@ -205,11 +206,13 @@ SocketAddress* Socket::GetRemotePeer(intptr_t fd, intptr_t* port) { |
void Socket::GetError(intptr_t fd, OSError* os_error) { |
int len = sizeof(errno); |
+ int err = 0; |
getsockopt(fd, |
SOL_SOCKET, |
SO_ERROR, |
- &errno, |
+ &err, |
reinterpret_cast<socklen_t*>(&len)); |
+ errno = err; |
os_error->SetCodeAndMessage(OSError::kSystem, errno); |
} |