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

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

Issue 10907248: Don't use TEMP_FAILURE_RETRY macro with inet_addr (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Modify change list to remove description of potential infinite loop. Not sure it is really possible. Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/bin/socket_linux.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 #include <errno.h> 5 #include <errno.h>
6 #include <stdio.h> 6 #include <stdio.h>
7 #include <stdlib.h> 7 #include <stdlib.h>
8 #include <string.h> 8 #include <string.h>
9 #include <unistd.h> 9 #include <unistd.h>
10 10
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 return buffer; 170 return buffer;
171 } 171 }
172 172
173 173
174 intptr_t ServerSocket::CreateBindListen(const char* host, 174 intptr_t ServerSocket::CreateBindListen(const char* host,
175 intptr_t port, 175 intptr_t port,
176 intptr_t backlog) { 176 intptr_t backlog) {
177 intptr_t fd; 177 intptr_t fd;
178 struct sockaddr_in server_address; 178 struct sockaddr_in server_address;
179 179
180 // Cast to/from int to work-around Android bug: 180 in_addr_t s_addr = inet_addr(host);
181 // http://code.google.com/p/android/issues/detail?id=37426
182 // unistd.h TEMP_FAILURE_RETRY generates warning when used with syscall that
183 // returns unsigned int.
184 in_addr_t s_addr = static_cast<in_addr_t>(
185 TEMP_FAILURE_RETRY(static_cast<int>(inet_addr(host))));
186 if (s_addr == INADDR_NONE) { 181 if (s_addr == INADDR_NONE) {
187 return -5; 182 return -5;
188 } 183 }
189 184
190 fd = TEMP_FAILURE_RETRY(socket(AF_INET, SOCK_STREAM, 0)); 185 fd = TEMP_FAILURE_RETRY(socket(AF_INET, SOCK_STREAM, 0));
191 if (fd < 0) { 186 if (fd < 0) {
192 fprintf(stderr, "Error CreateBind: %s\n", strerror(errno)); 187 fprintf(stderr, "Error CreateBind: %s\n", strerror(errno));
193 return -1; 188 return -1;
194 } 189 }
195 190
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 // error. We got woken up from the poll on the listening socket, 237 // error. We got woken up from the poll on the listening socket,
243 // but there is no connection ready to be accepted. 238 // but there is no connection ready to be accepted.
244 ASSERT(kTemporaryFailure != -1); 239 ASSERT(kTemporaryFailure != -1);
245 socket = kTemporaryFailure; 240 socket = kTemporaryFailure;
246 } 241 }
247 } else { 242 } else {
248 FDUtils::SetNonBlocking(socket); 243 FDUtils::SetNonBlocking(socket);
249 } 244 }
250 return socket; 245 return socket;
251 } 246 }
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/socket_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698