mirror of
https://github.com/ruby/ruby.git
synced 2025-08-24 21:44:30 +02:00
merge revision(s) r45046,r45047,r45063,r45087,r45146,r45150,r45151,r45152: [Backport #9525]
* ext/socket: Wrap struct addrinfo by struct rb_addrinfo. * ext/socket: Bypass getaddrinfo() if node and serv are numeric. Reporeted by Naotoshi Seo. [ruby-core:60801] [Bug #9525] * ext/socket/extconf.rb: Detect struct sockaddr_in6.sin6_len. * ext/socket/sockport.h (SET_SIN6_LEN): New macro. (INIT_SOCKADDR_IN6): Ditto. * ext/socket/rubysocket.h (struct rb_addrinfo): Add allocated_by_malloc field. * ext/socket/raddrinfo.c (numeric_getaddrinfo): New function. (rb_getaddrinfo): Call numeric_getaddrinfo at first. (rb_freeaddrinfo): Free struct addrinfo properly when it is allocated by numeric_getaddrinfo. * ext/socket/raddrinfo.c (numeric_getaddrinfo): Use xcalloc. Suggested by Eric Wong. https://bugs.ruby-lang.org/issues/9525#note-14 * ext/socket/raddrinfo.c (rb_getaddrinfo): second argument of MEMZERO is type. Coverity Scan found this bug. * include/ruby/win32.h, win32/win32.c (rb_w32_inet_pton): add a wrapper function for inet_pton minimum supported client is Vista, as well as inet_ntop. * ext/socket/option.c (inet_pton): use rb_w32_inet_pton, instead of inet_ntop directly, which is unavailable on older version Windows. * ext/socket/raddrinfo.c (inet_pton): use rb_w32_inet_pton, instead of inet_pton directly, which is unavailable on older version Windows. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47415 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
aac5c2c7af
commit
667af1ee31
8 changed files with 187 additions and 12 deletions
|
@ -6962,6 +6962,19 @@ rb_w32_inet_ntop(int af, const void *addr, char *numaddr, size_t numaddr_len)
|
|||
return numaddr;
|
||||
}
|
||||
|
||||
/* License: Ruby's */
|
||||
int WSAAPI
|
||||
rb_w32_inet_pton(int af, const char *src, void *dst)
|
||||
{
|
||||
typedef int (WSAAPI inet_pton_t)(int, const char*, void *);
|
||||
inet_pton_t *pInetPton;
|
||||
pInetPton = (inet_pton_t *)get_proc_address("ws2_32", "inet_pton", NULL);
|
||||
if (pInetPton) {
|
||||
return pInetPton(af, src, dst);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* License: Ruby's */
|
||||
char
|
||||
rb_w32_fd_is_text(int fd)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue