Merge commit '36d016afd663d34607c843d03371bedb71efa34e'
authorTakeshi Watanabe <[email protected]>
Sun, 25 Mar 2018 12:10:11 +0000 (25 21:10 +0900)
committerTakeshi Watanabe <[email protected]>
Sun, 25 Mar 2018 12:10:11 +0000 (25 21:10 +0900)
1  2 
mrbgems/mruby-socket/src/socket.c

@@@ -145,16 -138,16 +145,20 @@@ mrb_addrinfo_getaddrinfo(mrb_state *mrb
    }
  
    if (mrb_fixnum_p(socktype)) {
 -    hints.ai_socktype = mrb_fixnum(socktype);
 +    hints.ai_socktype = (int)mrb_fixnum(socktype);
 +  }
 +
 +  if (mrb_fixnum_p(protocol)) {
 +    hints.ai_protocol = (int)mrb_fixnum(protocol);
    }
  
+   if (mrb_fixnum_p(protocol)) {
+     hints.ai_protocol = mrb_fixnum(protocol);
+   }
    lastai = mrb_cv_get(mrb, klass, mrb_intern_lit(mrb, "_lastai"));
    if (mrb_cptr_p(lastai)) {
 -    freeaddrinfo(mrb_cptr(lastai));
 +    freeaddrinfo((struct addrinfo*)mrb_cptr(lastai));
      mrb_cv_set(mrb, klass, mrb_intern_lit(mrb, "_lastai"), mrb_nil_value());
    }