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

Side by Side Diff: tools/android/common/adb_connection.cc

Issue 100253002: Don't HANDLE_EINTR(close). Either IGNORE_EINTR(close) or just close. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years 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 | « third_party/leveldatabase/env_chromium.cc ('k') | tools/android/common/daemon.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 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 "tools/android/common/adb_connection.h" 5 #include "tools/android/common/adb_connection.h"
6 6
7 #include <arpa/inet.h> 7 #include <arpa/inet.h>
8 #include <errno.h> 8 #include <errno.h>
9 #include <stdio.h> 9 #include <stdio.h>
10 #include <stdlib.h> 10 #include <stdlib.h>
11 #include <sys/socket.h> 11 #include <sys/socket.h>
12 #include <sys/types.h> 12 #include <sys/types.h>
13 #include <unistd.h> 13 #include <unistd.h>
14 14
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "base/posix/eintr_wrapper.h" 16 #include "base/posix/eintr_wrapper.h"
17 #include "tools/android/common/net.h" 17 #include "tools/android/common/net.h"
18 18
19 namespace tools { 19 namespace tools {
20 namespace { 20 namespace {
21 21
22 void CloseSocket(int fd) { 22 void CloseSocket(int fd) {
23 if (fd >= 0) { 23 if (fd >= 0) {
24 int old_errno = errno; 24 int old_errno = errno;
25 (void) HANDLE_EINTR(close(fd)); 25 close(fd);
26 errno = old_errno; 26 errno = old_errno;
27 } 27 }
28 } 28 }
29 29
30 } // namespace 30 } // namespace
31 31
32 int ConnectAdbHostSocket(const char* forward_to) { 32 int ConnectAdbHostSocket(const char* forward_to) {
33 // ADB port forward request format: HHHHtcp:port:address. 33 // ADB port forward request format: HHHHtcp:port:address.
34 // HHHH is the hexidecimal length of the "tcp:port:address" part. 34 // HHHH is the hexidecimal length of the "tcp:port:address" part.
35 const size_t kBufferMaxLength = 30; 35 const size_t kBufferMaxLength = 30;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 LOG(ERROR) << "Bad response from ADB: length: " << response_length 98 LOG(ERROR) << "Bad response from ADB: length: " << response_length
99 << " data: " << DumpBinary(response, response_length); 99 << " data: " << DumpBinary(response, response_length);
100 CloseSocket(host_socket); 100 CloseSocket(host_socket);
101 return -1; 101 return -1;
102 } 102 }
103 103
104 return host_socket; 104 return host_socket;
105 } 105 }
106 106
107 } // namespace tools 107 } // namespace tools
OLDNEW
« no previous file with comments | « third_party/leveldatabase/env_chromium.cc ('k') | tools/android/common/daemon.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698