mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
receiver variables must be "mrb_int" for mrb_get_args("i").
Otherwise, it can cause a segfault on the platforms where the size of "int" and "mrb_int" differs.
This commit is contained in:
+4
-4
@@ -586,10 +586,10 @@ static mrb_value
|
||||
mrb_socket_bind(mrb_state *mrb, mrb_value klass)
|
||||
{
|
||||
mrb_value sastr;
|
||||
int s;
|
||||
mrb_int s;
|
||||
|
||||
mrb_get_args(mrb, "iS", &s, &sastr);
|
||||
if (bind(s, (struct sockaddr *)RSTRING_PTR(sastr), (socklen_t)RSTRING_LEN(sastr)) == -1) {
|
||||
if (bind((int)s, (struct sockaddr *)RSTRING_PTR(sastr), (socklen_t)RSTRING_LEN(sastr)) == -1) {
|
||||
mrb_sys_fail(mrb, "bind");
|
||||
}
|
||||
return mrb_nil_value();
|
||||
@@ -599,10 +599,10 @@ static mrb_value
|
||||
mrb_socket_connect(mrb_state *mrb, mrb_value klass)
|
||||
{
|
||||
mrb_value sastr;
|
||||
int s;
|
||||
mrb_int s;
|
||||
|
||||
mrb_get_args(mrb, "iS", &s, &sastr);
|
||||
if (connect(s, (struct sockaddr *)RSTRING_PTR(sastr), (socklen_t)RSTRING_LEN(sastr)) == -1) {
|
||||
if (connect((int)s, (struct sockaddr *)RSTRING_PTR(sastr), (socklen_t)RSTRING_LEN(sastr)) == -1) {
|
||||
mrb_sys_fail(mrb, "connect");
|
||||
}
|
||||
return mrb_nil_value();
|
||||
|
||||
Reference in New Issue
Block a user