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

Side by Side Diff: native_client_sdk/src/libraries/nacl_io/kernel_proxy.cc

Issue 804993008: nacl_io: accept now allows addr and len to be NULL (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove incorrect tests Created 5 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "nacl_io/kernel_proxy.h" 5 #include "nacl_io/kernel_proxy.h"
6 6
7 #include <assert.h> 7 #include <assert.h>
8 #include <errno.h> 8 #include <errno.h>
9 #include <fcntl.h> 9 #include <fcntl.h>
10 #include <limits.h> 10 #include <limits.h>
(...skipping 1344 matching lines...) Expand 10 before | Expand all | Expand 10 after
1355 } 1355 }
1356 } 1356 }
1357 } 1357 }
1358 } 1358 }
1359 1359
1360 return event_cnt; 1360 return event_cnt;
1361 } 1361 }
1362 1362
1363 // Socket Functions 1363 // Socket Functions
1364 int KernelProxy::accept(int fd, struct sockaddr* addr, socklen_t* len) { 1364 int KernelProxy::accept(int fd, struct sockaddr* addr, socklen_t* len) {
1365 if (NULL == addr || NULL == len) {
1366 errno = EFAULT;
1367 return -1;
1368 }
1369
1370 ScopedKernelHandle handle; 1365 ScopedKernelHandle handle;
1371 Error error = AcquireHandle(fd, &handle); 1366 Error error = AcquireHandle(fd, &handle);
1372 if (error) { 1367 if (error) {
1373 errno = error; 1368 errno = error;
1374 return -1; 1369 return -1;
1375 } 1370 }
1376 1371
1377 PP_Resource new_sock = 0; 1372 PP_Resource new_sock = 0;
1378 error = handle->Accept(&new_sock, addr, len); 1373 error = handle->Accept(&new_sock, addr, len);
1379 if (error != 0) { 1374 if (error != 0) {
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
1818 errno = ENOTSOCK; 1813 errno = ENOTSOCK;
1819 return -1; 1814 return -1;
1820 } 1815 }
1821 1816
1822 return 0; 1817 return 0;
1823 } 1818 }
1824 1819
1825 #endif // PROVIDES_SOCKET_API 1820 #endif // PROVIDES_SOCKET_API
1826 1821
1827 } // namespace_nacl_io 1822 } // namespace_nacl_io
OLDNEW
« no previous file with comments | « native_client_sdk/src/AUTHORS ('k') | native_client_sdk/src/libraries/nacl_io/socket/tcp_node.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698