X-Git-Url: http://cvs.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/7afa751a9673c0427d75116eac14dce2d19adedb..e49d31c0e798d14d8b0607b953f06dceecb4a42e:/uart/uart_posix.c diff --git a/uart/uart_posix.c b/uart/uart_posix.c index 214cb56a..29a02cf7 100644 --- a/uart/uart_posix.c +++ b/uart/uart_posix.c @@ -80,7 +80,7 @@ serial_port uart_open(const char* pcPortName) if (sp == 0) return INVALID_SERIAL_PORT; if (memcmp(pcPortName, "tcp:", 4) == 0) { - struct addrinfo *addr, *rp; + struct addrinfo *addr = NULL, *rp; char *addrstr = strdup(pcPortName + 4); if (addrstr == NULL) { printf("Error: strdup\n"); @@ -98,7 +98,13 @@ serial_port uart_open(const char* pcPortName) } else portstr = "7901"; - int s = getaddrinfo(addrstr, portstr, NULL, &addr); + struct addrinfo info; + + memset (&info, 0, sizeof(info)); + + info.ai_socktype = SOCK_STREAM; + + int s = getaddrinfo(addrstr, portstr, &info, &addr); if (s != 0) { printf("Error: getaddrinfo: %s\n", gai_strerror(s)); return INVALID_SERIAL_PORT;