ruby-changes:45281
From: normal <ko1@a...>
Date: Tue, 17 Jan 2017 06:42:09 +0900 (JST)
Subject: [ruby-changes:45281] normal:r57354 (trunk): basicsocket (rsock_bsock_send): do not truncate return value
normal 2017-01-17 06:42:05 +0900 (Tue, 17 Jan 2017) New Revision: 57354 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=57354 Log: 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. Modified files: trunk/ext/socket/basicsocket.c Index: ext/socket/basicsocket.c =================================================================== --- ext/socket/basicsocket.c (revision 57353) +++ ext/socket/basicsocket.c (revision 57354) @@ -530,7 +530,7 @@ rsock_bsock_send(int argc, VALUE *argv, https://github.com/ruby/ruby/blob/trunk/ext/socket/basicsocket.c#L530 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, https://github.com/ruby/ruby/blob/trunk/ext/socket/basicsocket.c#L550 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); } /* -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/