summaryrefslogtreecommitdiff
path: root/src/socket.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/socket.c')
-rw-r--r--src/socket.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/socket.c b/src/socket.c
index 9b5d78a..0b6f674 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -86,8 +86,11 @@ int HX_addrport_split(const char *spec, char *host,
unsigned long hlen = end - spec;
if (hlen >= hbufsz)
return -E2BIG;
- if (*++end == '\0')
+ if (*++end == '\0') {
+ memmove(host, spec, hlen);
+ host[hlen] = '\0';
return 1;
+ }
if (*end++ != ':')
return -EINVAL;
char *nend = nullptr;
@@ -146,6 +149,8 @@ int HX_inet_connect(const char *host, uint16_t port, unsigned int oflags)
struct addrinfo *aires = nullptr;
int ret = HX_inet_lookup(host, port, AI_ADDRCONFIG, &aires);
int saved_errno = 0;
+ if (ret != 0)
+ ;
for (const struct addrinfo *r = aires; r != nullptr; r = r->ai_next) {
int fd = socket(r->ai_family, r->ai_socktype, r->ai_protocol);
if (fd < 0) {