mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/socket/socket.c (sock_s_pack_sockaddr_un): calculate the
correct address length of an abstract socket. * test/socket/test_unix.rb: related test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38963 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
616f2c43c6
commit
a1ed445b81
3 changed files with 14 additions and 5 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
Tue Jan 29 09:26:20 2013 Shugo Maeda <shugo@ruby-lang.org>
|
||||||
|
|
||||||
|
* ext/socket/socket.c (sock_s_pack_sockaddr_un): calculate the
|
||||||
|
correct address length of an abstract socket.
|
||||||
|
|
||||||
|
* test/socket/test_unix.rb: related test.
|
||||||
|
|
||||||
Mon Jan 28 18:02:16 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Mon Jan 28 18:02:16 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* vm_backtrace.c (rb_debug_inspector_frame_{class,binding,iseq}_get):
|
* vm_backtrace.c (rb_debug_inspector_frame_{class,binding,iseq}_get):
|
||||||
|
|
|
@ -1430,7 +1430,7 @@ sock_s_pack_sockaddr_un(VALUE self, VALUE path)
|
||||||
(size_t)RSTRING_LEN(path), sizeof(sockaddr.sun_path));
|
(size_t)RSTRING_LEN(path), sizeof(sockaddr.sun_path));
|
||||||
}
|
}
|
||||||
memcpy(sockaddr.sun_path, RSTRING_PTR(path), RSTRING_LEN(path));
|
memcpy(sockaddr.sun_path, RSTRING_PTR(path), RSTRING_LEN(path));
|
||||||
addr = rb_str_new((char*)&sockaddr, sizeof(sockaddr));
|
addr = rb_str_new((char*)&sockaddr, rsock_unix_sockaddr_len(path));
|
||||||
OBJ_INFECT(addr, path);
|
OBJ_INFECT(addr, path);
|
||||||
|
|
||||||
return addr;
|
return addr;
|
||||||
|
|
|
@ -339,10 +339,12 @@ class TestSocket_UNIXSocket < Test::Unit::TestCase
|
||||||
assert_raise(ArgumentError) { UNIXServer.new("a" * 300) }
|
assert_raise(ArgumentError) { UNIXServer.new("a" * 300) }
|
||||||
end
|
end
|
||||||
|
|
||||||
#def test_nul
|
def test_abstract_namespace
|
||||||
# # path may contain NULs for abstract unix sockets. [ruby-core:10288]
|
return if /linux/ !~ RUBY_PLATFORM
|
||||||
# assert_raise(ArgumentError) { Socket.sockaddr_un("a\0b") }
|
addr = Socket.pack_sockaddr_un("\0foo")
|
||||||
#end
|
assert_match(/\0foo\z/, addr)
|
||||||
|
assert_equal("\0foo", Socket.unpack_sockaddr_un(addr))
|
||||||
|
end
|
||||||
|
|
||||||
def test_dgram_pair
|
def test_dgram_pair
|
||||||
s1, s2 = UNIXSocket.pair(Socket::SOCK_DGRAM)
|
s1, s2 = UNIXSocket.pair(Socket::SOCK_DGRAM)
|
||||||
|
|
Loading…
Add table
Reference in a new issue