summaryrefslogtreecommitdiff
path: root/test/socket
diff options
context:
space:
mode:
authorshugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-01-29 00:32:05 +0000
committershugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-01-29 00:32:05 +0000
commita1ed445b812d8aa335700c0bda5e3bd70cc33d20 (patch)
tree31dc641d95d4fa2e19a926644fd9de8a55ce9405 /test/socket
parent616f2c43c6e3693957cbecfbfbf9134163c88ef8 (diff)
* 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
Diffstat (limited to 'test/socket')
-rw-r--r--test/socket/test_unix.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/test/socket/test_unix.rb b/test/socket/test_unix.rb
index a44ef2de38..90f641efe5 100644
--- a/test/socket/test_unix.rb
+++ b/test/socket/test_unix.rb
@@ -339,10 +339,12 @@ class TestSocket_UNIXSocket < Test::Unit::TestCase
assert_raise(ArgumentError) { UNIXServer.new("a" * 300) }
end
- #def test_nul
- # # path may contain NULs for abstract unix sockets. [ruby-core:10288]
- # assert_raise(ArgumentError) { Socket.sockaddr_un("a\0b") }
- #end
+ def test_abstract_namespace
+ return if /linux/ !~ RUBY_PLATFORM
+ addr = Socket.pack_sockaddr_un("\0foo")
+ assert_match(/\0foo\z/, addr)
+ assert_equal("\0foo", Socket.unpack_sockaddr_un(addr))
+ end
def test_dgram_pair
s1, s2 = UNIXSocket.pair(Socket::SOCK_DGRAM)