summaryrefslogtreecommitdiff
path: root/ext/socket
diff options
context:
space:
mode:
Diffstat (limited to 'ext/socket')
-rw-r--r--ext/socket/getaddrinfo.c6
-rw-r--r--ext/socket/socket.c8
2 files changed, 9 insertions, 5 deletions
diff --git a/ext/socket/getaddrinfo.c b/ext/socket/getaddrinfo.c
index 4f58a23d2d..c05fbd57ba 100644
--- a/ext/socket/getaddrinfo.c
+++ b/ext/socket/getaddrinfo.c
@@ -397,7 +397,7 @@ getaddrinfo(hostname, servname, hints, res)
fprintf(stderr, "panic!\n");
break;
}
- if ((sp = getservbyname(servname, proto)) == NULL)
+ if ((sp = getservbyname((char*)servname, proto)) == NULL)
ERR(EAI_SERVICE);
port = sp->s_port;
if (pai->ai_socktype == ANY)
@@ -554,7 +554,7 @@ get_name(addr, afd, res, numaddr, pai, port0)
#ifdef INET6
hp = getipnodebyaddr(addr, afd->a_addrlen, afd->a_af, &h_error);
#else
- hp = gethostbyaddr(addr, afd->a_addrlen, AF_INET);
+ hp = gethostbyaddr((char*)addr, afd->a_addrlen, AF_INET);
#endif
if (hp && hp->h_name && hp->h_name[0] && hp->h_addr_list[0]) {
GET_AI(cur, afd, hp->h_addr_list[0], port);
@@ -606,7 +606,7 @@ get_addr(hostname, af, res, pai, port0)
} else
hp = getipnodebyname(hostname, af, AI_ADDRCONFIG, &h_error);
#else
- hp = gethostbyname(hostname);
+ hp = gethostbyname((char*)hostname);
h_error = h_errno;
#endif
if (hp == NULL) {
diff --git a/ext/socket/socket.c b/ext/socket/socket.c
index e30d25404d..5cebe593bc 100644
--- a/ext/socket/socket.c
+++ b/ext/socket/socket.c
@@ -13,6 +13,7 @@
#include "ruby.h"
#include "rubyio.h"
#include "rubysig.h"
+#include "util.h"
#include <stdio.h>
#include <sys/types.h>
@@ -31,6 +32,9 @@
# include <sys/socket.h>
#endif
#include <netinet/in.h>
+#ifdef HAVE_NETINET_IN_SYSTM_H
+# include <netinet/in_systm.h>
+#endif
#ifdef HAVE_NETINET_TCP_H
# include <netinet/tcp.h>
#endif
@@ -2016,7 +2020,7 @@ sock_s_gethostbyaddr(argc, argv)
t = AF_INET6;
}
#endif
- h = gethostbyaddr(RSTRING(addr)->ptr, RSTRING(addr)->len, t);
+ h = gethostbyaddr((char*)RSTRING(addr)->ptr, RSTRING(addr)->len, t);
if (h == NULL) {
#ifdef HAVE_HSTRERROR
extern int h_errno;
@@ -2061,7 +2065,7 @@ sock_s_getservbyaname(argc, argv)
else proto = StringValuePtr(protocol);
StringValue(service);
- sp = getservbyname(RSTRING(service)->ptr, proto);
+ sp = getservbyname((char*)RSTRING(service)->ptr, proto);
if (sp) {
port = ntohs(sp->s_port);
}