summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/socket/getnameinfo.c3
-rw-r--r--ext/socket/socket.c2
2 files changed, 3 insertions, 2 deletions
diff --git a/ext/socket/getnameinfo.c b/ext/socket/getnameinfo.c
index aee81b5..a77faf9 100644
--- a/ext/socket/getnameinfo.c
+++ b/ext/socket/getnameinfo.c
@@ -135,7 +135,6 @@ int
getnameinfo(const struct sockaddr *sa, size_t salen, char *host, size_t hostlen, char *serv, size_t servlen, int flags)
{
struct afd *afd;
- struct servent *sp;
struct hostent *hp;
u_short port;
int family, len, i;
@@ -177,7 +176,7 @@ getnameinfo(const struct sockaddr *sa, size_t salen, char *host, size_t hostlen,
strcpy(serv, numserv);
} else {
#if defined(HAVE_GETSERVBYPORT)
- sp = getservbyport(port, (flags & NI_DGRAM) ? "udp" : "tcp");
+ struct servent *sp = getservbyport(port, (flags & NI_DGRAM) ? "udp" : "tcp");
if (sp) {
if (strlen(sp->s_name) + 1 > servlen)
return ENI_MEMORY;
diff --git a/ext/socket/socket.c b/ext/socket/socket.c
index 5816419..88a827e 100644
--- a/ext/socket/socket.c
+++ b/ext/socket/socket.c
@@ -2428,6 +2428,7 @@ sock_initialize(VALUE sock, VALUE domain, VALUE type, VALUE protocol)
return init_sock(sock, fd);
}
+#if defined HAVE_SOCKETPAIR
static VALUE
io_call_close(VALUE io)
{
@@ -2445,6 +2446,7 @@ pair_yield(VALUE pair)
{
return rb_ensure(rb_yield, pair, io_close, rb_ary_entry(pair, 1));
}
+#endif
static VALUE
sock_s_socketpair(VALUE klass, VALUE domain, VALUE type, VALUE protocol)