mirror of
https://github.com/ruby/ruby.git
synced 2025-08-23 13:04:13 +02:00
* ext/socket/raddrinfo.c (rsock_unix_sockaddr_len): return
sizeof(sa_familiy_t) if path is empty. see "Autobind Feature" in unix(7) for details. * ext/socket/lib/socket.rb (unix_socket_abstract_name?): treat an empty path as an abstract name. * test/socket/test_unix.rb: related test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38994 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1ff38a5bbf
commit
4ccfb2743f
4 changed files with 46 additions and 4 deletions
|
@ -446,7 +446,11 @@ socklen_t
|
|||
rsock_unix_sockaddr_len(VALUE path)
|
||||
{
|
||||
#ifdef __linux__
|
||||
if (RSTRING_PTR(path)[0] == '\0') {
|
||||
if (RSTRING_LEN(path) == 0) {
|
||||
/* autobind; see unix(7) for details. */
|
||||
return (socklen_t) sizeof(sa_family_t);
|
||||
}
|
||||
else if (RSTRING_PTR(path)[0] == '\0') {
|
||||
/* abstract namespace; see unix(7) for details. */
|
||||
return (socklen_t) offsetof(struct sockaddr_un, sun_path) +
|
||||
RSTRING_LEN(path);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue