summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/socket/init.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/ext/socket/init.c b/ext/socket/init.c
index bd069263c6..bc01217641 100644
--- a/ext/socket/init.c
+++ b/ext/socket/init.c
@@ -61,8 +61,10 @@ rsock_init_sock(VALUE sock, int fd)
{
rb_io_t *fp;
- if (!is_socket(fd))
- rb_raise(rb_eArgError, "not a socket file descriptor");
+ if (!is_socket(fd)) {
+ errno = EBADF;
+ rb_sys_fail("not a socket file descriptor");
+ }
rb_update_max_fd(fd);
MakeOpenFile(sock, fp);