summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--ext/socket/unixsocket.c2
-rw-r--r--test/socket/test_unix.rb8
3 files changed, 16 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 9a0356bfd5..e956677c24 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Wed Jan 30 15:26:37 2013 Shugo Maeda <shugo@ruby-lang.org>
+
+ * 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@ruby-lang.org>
* vm_dump.c (rb_vm_bugreport): show the most important message, Crash
diff --git a/ext/socket/unixsocket.c b/ext/socket/unixsocket.c
index 7bc523b145..84dcacd98d 100644
--- a/ext/socket/unixsocket.c
+++ b/ext/socket/unixsocket.c
@@ -66,7 +66,7 @@ rsock_init_unixsock(VALUE sock, VALUE path, int server)
if (status < 0) {
close(fd);
- rb_sys_fail_str(path);
+ rb_sys_fail_str(rb_inspect(path));
}
if (server) {
diff --git a/test/socket/test_unix.rb b/test/socket/test_unix.rb
index 90f641efe5..19efb32219 100644
--- a/test/socket/test_unix.rb
+++ b/test/socket/test_unix.rb
@@ -548,6 +548,14 @@ class TestSocket_UNIXSocket < Test::Unit::TestCase
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"