ruby-changes:26939
From: shugo <ko1@a...>
Date: Wed, 30 Jan 2013 15:30:23 +0900 (JST)
Subject: [ruby-changes:26939] shugo:r38991 (trunk): * ext/socket/unixsocket.c (rsock_init_unixsock): use rb_inspect()
shugo 2013-01-30 15:30:12 +0900 (Wed, 30 Jan 2013) New Revision: 38991 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=38991 Log: * ext/socket/unixsocket.c (rsock_init_unixsock): use rb_inspect() because rb_sys_fail_str() fails if its argument contains NUL. * test/socket/test_unix.rb: related test. Modified files: trunk/ChangeLog trunk/ext/socket/unixsocket.c trunk/test/socket/test_unix.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 38990) +++ ChangeLog (revision 38991) @@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Wed Jan 30 15:26:37 2013 Shugo Maeda <shugo@r...> + + * ext/socket/unixsocket.c (rsock_init_unixsock): use rb_inspect() + because rb_sys_fail_str() fails if its argument contains NUL. + + * test/socket/test_unix.rb: related test. + Wed Jan 30 15:21:30 2013 Nobuyoshi Nakada <nobu@r...> * vm_dump.c (rb_vm_bugreport): show the most important message, Crash Index: ext/socket/unixsocket.c =================================================================== --- ext/socket/unixsocket.c (revision 38990) +++ ext/socket/unixsocket.c (revision 38991) @@ -66,7 +66,7 @@ rsock_init_unixsock(VALUE sock, VALUE pa https://github.com/ruby/ruby/blob/trunk/ext/socket/unixsocket.c#L66 if (status < 0) { close(fd); - rb_sys_fail_str(path); + rb_sys_fail_str(rb_inspect(path)); } if (server) { Index: test/socket/test_unix.rb =================================================================== --- test/socket/test_unix.rb (revision 38990) +++ test/socket/test_unix.rb (revision 38991) @@ -548,6 +548,14 @@ class TestSocket_UNIXSocket < Test::Unit https://github.com/ruby/ruby/blob/trunk/test/socket/test_unix.rb#L548 assert(s0.closed?) end + def test_abstract_unix_socket_econnrefused + return if /linux/ !~ RUBY_PLATFORM + name = "\0ruby-test_unix" + assert_raise(Errno::ECONNREFUSED) do + UNIXSocket.open(name) {} + end + end + def test_abstract_unix_server_socket return if /linux/ !~ RUBY_PLATFORM name = "\0ruby-test_unix" -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/