diff options
author | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-01-16 21:42:05 +0000 |
---|---|---|
committer | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-01-16 21:42:05 +0000 |
commit | a34f9c7e9ae4139e372f10e77fbceb9ea847950f (patch) | |
tree | e34924a443690fd0f4a3127b82293abebc5e3957 /ext/socket/basicsocket.c | |
parent | 650a8ce8392dced0f9026caeb95130a9f6ba550e (diff) | |
download | ruby-a34f9c7e9ae4139e372f10e77fbceb9ea847950f.tar.gz |
basicsocket (rsock_bsock_send): do not truncate return value
send(2) and sendto(2) syscalls return `ssize_t', use the
proper type and macro for converting to a Numeric VALUE.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket/basicsocket.c')
-rw-r--r-- | ext/socket/basicsocket.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ext/socket/basicsocket.c b/ext/socket/basicsocket.c index 264b882500..3b6f22f36a 100644 --- a/ext/socket/basicsocket.c +++ b/ext/socket/basicsocket.c @@ -530,7 +530,7 @@ rsock_bsock_send(int argc, VALUE *argv, VALUE sock) struct rsock_send_arg arg; VALUE flags, to; rb_io_t *fptr; - int n; + ssize_t n; rb_blocking_function_t *func; rb_scan_args(argc, argv, "21", &arg.mesg, &flags, &to); @@ -550,13 +550,13 @@ rsock_bsock_send(int argc, VALUE *argv, VALUE sock) arg.fd = fptr->fd; arg.flags = NUM2INT(flags); while (rsock_maybe_fd_writable(arg.fd), - (n = (int)BLOCKING_REGION_FD(func, &arg)) < 0) { + (n = (ssize_t)BLOCKING_REGION_FD(func, &arg)) < 0) { if (rb_io_wait_writable(arg.fd)) { continue; } rb_sys_fail("send(2)"); } - return INT2FIX(n); + return SSIZET2NUM(n); } /* |