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

Unified Diff: native_client_sdk/src/libraries/nacl_io/mount_node_socket.cc

Issue 23456045: [NaCl SDK] nacl_io: Add initial support for getsockopt (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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: native_client_sdk/src/libraries/nacl_io/mount_node_socket.cc
diff --git a/native_client_sdk/src/libraries/nacl_io/mount_node_socket.cc b/native_client_sdk/src/libraries/nacl_io/mount_node_socket.cc
index abaf55ba1e9e48ae0a89fa16d08b65d87ce62962..4aa780947081ba8e330f2a0d3081b767a5a20e56 100644
--- a/native_client_sdk/src/libraries/nacl_io/mount_node_socket.cc
+++ b/native_client_sdk/src/libraries/nacl_io/mount_node_socket.cc
@@ -204,6 +204,18 @@ Error MountNodeSocket::GetSockOpt(int lvl,
int optname,
void* optval,
socklen_t* len) {
+ if (lvl != SOL_SOCKET)
+ return EINVAL;
+
+ switch (optname) {
+ case SO_ERROR:
+ if (*len < sizeof(int))
binji 2013/09/30 16:37:48 http://pubs.opengroup.org/onlinepubs/009695399/fun
Sam Clegg 2013/09/30 17:33:25 Done.
+ return EINVAL;
+ *static_cast<int*>(optval) = 0;
binji 2013/09/30 16:37:48 always 0? This probably needs to be a virtual func
Sam Clegg 2013/09/30 17:33:25 Done.
+ *len = sizeof(int);
+ return 0;
+ }
+
return EINVAL;
}
@@ -372,4 +384,4 @@ Error MountNodeSocket::GetSockName(struct sockaddr* addr, socklen_t* len) {
} // namespace nacl_io
-#endif // PROVIDES_SOCKET_API
+#endif // PROVIDES_SOCKET_API

Powered by Google App Engine
This is Rietveld 408576698