summaryrefslogtreecommitdiff
path: root/ext/socket
diff options
context:
space:
mode:
Diffstat (limited to 'ext/socket')
-rw-r--r--ext/socket/init.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ext/socket/init.c b/ext/socket/init.c
index 00e20fa308..1710129519 100644
--- a/ext/socket/init.c
+++ b/ext/socket/init.c
@@ -35,7 +35,9 @@ void
rsock_raise_socket_error(const char *reason, int error)
{
#ifdef EAI_SYSTEM
- if (error == EAI_SYSTEM) rb_sys_fail(reason);
+ int e;
+ if (error == EAI_SYSTEM && (e = errno) != 0)
+ rb_syserr_fail(e, reason);
#endif
rb_raise(rb_eSocket, "%s: %s", reason, gai_strerror(error));
}