Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d48dbd89 authored by Elliott Hughes's avatar Elliott Hughes
Browse files

Fix Win32 adb build.

Change-Id: I0a07379c470b7fa7f9bdef68c17ccb7bd0bd2079
parent addf7a96
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -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);
+0 −5
Original line number Diff line number Diff line
@@ -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
+3 −1
Original line number Diff line number Diff line
@@ -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;