diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libc/net/socket.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/libc/net/socket.c b/src/libc/net/socket.c index 04d73f4..ce74029 100644 --- a/src/libc/net/socket.c +++ b/src/libc/net/socket.c @@ -49,7 +49,16 @@ int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen) { ip = ntohl(addr4->sin_addr.s_addr); port = ntohs(addr4->sin_port); - if (snprintf(buf, 256, "/net/connect/0/%ld/tcp/%d", ip, port) >= 256) { + if ( + snprintf(buf, sizeof(buf), + "/net/connect/0.0.0.0/%d.%d.%d.%d/tcp/%d", + (ip >> 24) & 0xFF, + (ip >> 16) & 0xFF, + (ip >> 8) & 0xFF, + (ip ) & 0xFF, + port + ) >= 256 + ) { return errno = EGENERIC, -1; } newfd = camellia_open(buf, OPEN_READ | OPEN_WRITE); |