summaryrefslogtreecommitdiff
path: root/ext/socket
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-22 13:45:14 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-22 13:45:14 +0000
commit4eac2e833cf1518f676a468bec6ad161062431bc (patch)
treef95bd0e3f6269006f731a7fbe64a8daaf66f836c /ext/socket
parent96ac47c25109abfd846eb45ae6cb6b56c8b178e3 (diff)
fix r53231: raise Errno::EBADF like other OSes
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53244 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket')
-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 bd06926..bc01217 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);