Skip to content

Commit

Permalink
define in4addr_loopback when not using visual studio (#410)
Browse files Browse the repository at this point in the history
define in4addr_loopback when not using visual studio - fixes mingw build error
  • Loading branch information
scareything authored Jun 13, 2022
1 parent ce91b21 commit 3f24040
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions library/zitilib.c
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,16 @@ static const char * fmt_win32err(int err) {
}
#endif

#ifdef __MINGW32__
static const IN_ADDR in4addr_loopback;
static void init_in4addr_loopback() {
IN_ADDR *lo = (IN_ADDR *)&in4addr_loopback;
lo->S_un.S_addr = htonl(INADDR_LOOPBACK);
}
#else
#define init_in4addr_loopback() {}
#endif

static int make_socketpair(int type, ziti_socket_t *fd0, ziti_socket_t *fd1) {
int rc = 0;
#if _WIN32
Expand Down Expand Up @@ -872,6 +882,7 @@ void process_on_loop(uv_async_t *async) {
}

static void internal_init() {
init_in4addr_loopback();
uv_key_create(&err_key);
uv_mutex_init(&q_mut);
lib_loop = uv_loop_new();
Expand Down

0 comments on commit 3f24040

Please sign in to comment.