mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
650a8ce839
commit
a34f9c7e9a
1 changed files with 3 additions and 3 deletions
|
@ -530,7 +530,7 @@ rsock_bsock_send(int argc, VALUE *argv, VALUE sock)
|
||||||
struct rsock_send_arg arg;
|
struct rsock_send_arg arg;
|
||||||
VALUE flags, to;
|
VALUE flags, to;
|
||||||
rb_io_t *fptr;
|
rb_io_t *fptr;
|
||||||
int n;
|
ssize_t n;
|
||||||
rb_blocking_function_t *func;
|
rb_blocking_function_t *func;
|
||||||
|
|
||||||
rb_scan_args(argc, argv, "21", &arg.mesg, &flags, &to);
|
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.fd = fptr->fd;
|
||||||
arg.flags = NUM2INT(flags);
|
arg.flags = NUM2INT(flags);
|
||||||
while (rsock_maybe_fd_writable(arg.fd),
|
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)) {
|
if (rb_io_wait_writable(arg.fd)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
rb_sys_fail("send(2)");
|
rb_sys_fail("send(2)");
|
||||||
}
|
}
|
||||||
return INT2FIX(n);
|
return SSIZET2NUM(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue