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

Side by Side Diff: runtime/bin/socket_linux.cc

Issue 1916223003: Fixes NetworkInterface.list crash on Android (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « runtime/bin/socket_android.cc ('k') | runtime/bin/socket_macos.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #if !defined(DART_IO_DISABLED) 5 #if !defined(DART_IO_DISABLED)
6 6
7 #include "platform/globals.h" 7 #include "platform/globals.h"
8 #if defined(TARGET_OS_LINUX) 8 #if defined(TARGET_OS_LINUX)
9 9
10 #include "bin/socket.h" 10 #include "bin/socket.h"
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 // OpenVPN's virtual device tun0. 331 // OpenVPN's virtual device tun0.
332 return false; 332 return false;
333 } 333 }
334 int family = ifa->ifa_addr->sa_family; 334 int family = ifa->ifa_addr->sa_family;
335 return ((lookup_family == family) || 335 return ((lookup_family == family) ||
336 (((lookup_family == AF_UNSPEC) && 336 (((lookup_family == AF_UNSPEC) &&
337 ((family == AF_INET) || (family == AF_INET6))))); 337 ((family == AF_INET) || (family == AF_INET6)))));
338 } 338 }
339 339
340 340
341 bool Socket::ListInterfacesSupported() {
342 return true;
343 }
344
345
341 AddressList<InterfaceSocketAddress>* Socket::ListInterfaces( 346 AddressList<InterfaceSocketAddress>* Socket::ListInterfaces(
342 int type, 347 int type,
343 OSError** os_error) { 348 OSError** os_error) {
344 struct ifaddrs* ifaddr; 349 struct ifaddrs* ifaddr;
345 350
346 int status = NO_RETRY_EXPECTED(getifaddrs(&ifaddr)); 351 int status = NO_RETRY_EXPECTED(getifaddrs(&ifaddr));
347 if (status != 0) { 352 if (status != 0) {
348 ASSERT(*os_error == NULL); 353 ASSERT(*os_error == NULL);
349 *os_error = new OSError(status, 354 *os_error = new OSError(status,
350 gai_strerror(status), 355 gai_strerror(status),
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 return NO_RETRY_EXPECTED( 587 return NO_RETRY_EXPECTED(
583 setsockopt(fd, proto, MCAST_LEAVE_GROUP, &mreq, sizeof(mreq))) == 0; 588 setsockopt(fd, proto, MCAST_LEAVE_GROUP, &mreq, sizeof(mreq))) == 0;
584 } 589 }
585 590
586 } // namespace bin 591 } // namespace bin
587 } // namespace dart 592 } // namespace dart
588 593
589 #endif // defined(TARGET_OS_LINUX) 594 #endif // defined(TARGET_OS_LINUX)
590 595
591 #endif // !defined(DART_IO_DISABLED) 596 #endif // !defined(DART_IO_DISABLED)
OLDNEW
« no previous file with comments | « runtime/bin/socket_android.cc ('k') | runtime/bin/socket_macos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698