Merge "Fix Win32 adb build."

This commit is contained in:
Elliott Hughes 2015-07-24 18:36:56 +00:00 committed by Gerrit Code Review
commit 2e942a4796
3 changed files with 10 additions and 8 deletions

View File

@ -18,7 +18,6 @@
#include "adb_utils.h"
#include <netdb.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
@ -34,6 +33,12 @@
#include "adb_trace.h"
#include "sysdeps.h"
#if defined(_WIN32)
#include <ws2tcpip.h>
#else
#include <netdb.h>
#endif
bool getcwd(std::string* s) {
char* cwd = getcwd(nullptr, 0);
if (cwd != nullptr) *s = cwd;
@ -168,7 +173,7 @@ int network_connect(const std::string& host, int port, int type, int timeout, st
return fd;
}
if (getaddrinfo_error != 0) {
// TODO: not thread safe on Win32.
// TODO: gai_strerror is not thread safe on Win32.
*error = gai_strerror(getaddrinfo_error);
} else {
*error = strerror(errno);

View File

@ -187,11 +187,6 @@ static __inline__ int unix_open(const char* path, int options,...)
/* normally provided by <cutils/misc.h> */
extern void* load_file(const char* pathname, unsigned* psize);
/* normally provided by <cutils/sockets.h> */
extern int socket_loopback_client(int port, int type);
extern int socket_loopback_server(int port, int type);
extern int socket_inaddr_any_server(int port, int type);
/* normally provided by "fdevent.h" */
#define FDE_READ 0x0001

View File

@ -25,6 +25,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <cutils/sockets.h>
#include "adb.h"
extern void fatal(const char *fmt, ...);
@ -669,7 +671,7 @@ int socket_loopback_server(int port, int type)
int socket_network_client_timeout(const char *host, int port, int type, int timeout,
std::string* error) {
int* getaddrinfo_error) {
FH f = _fh_alloc( &_fh_socket_class );
if (!f) return -1;