* ext/socket/socket.c (rsock_sys_fail_path): Use rb_str_inspect if the
path contains a NUL. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40150 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d933fb2296
commit
11a9d77286
@ -1,3 +1,8 @@
|
|||||||
|
Sat Apr 6 11:49:35 2013 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
|
* ext/socket/socket.c (rsock_sys_fail_path): Use rb_str_inspect if the
|
||||||
|
path contains a NUL.
|
||||||
|
|
||||||
Sat Apr 6 11:39:19 2013 Tanaka Akira <akr@fsij.org>
|
Sat Apr 6 11:39:19 2013 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* ext/socket: Improve socket exception message to show socket address.
|
* ext/socket: Improve socket exception message to show socket address.
|
||||||
|
@ -28,9 +28,16 @@ rsock_sys_fail_host_port(const char *mesg, VALUE host, VALUE port)
|
|||||||
void
|
void
|
||||||
rsock_sys_fail_path(const char *mesg, VALUE path)
|
rsock_sys_fail_path(const char *mesg, VALUE path)
|
||||||
{
|
{
|
||||||
VALUE message = rb_sprintf("%s for \"%s\"",
|
VALUE message;
|
||||||
mesg, StringValueCStr(path));
|
if (memchr(RSTRING_PTR(path), '\0', RSTRING_LEN(path))) {
|
||||||
|
path = rb_str_inspect(path);
|
||||||
|
message = rb_sprintf("%s for %s", mesg,
|
||||||
|
StringValueCStr(path));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
message = rb_sprintf("%s for \"%s\"", mesg,
|
||||||
|
StringValueCStr(path));
|
||||||
|
}
|
||||||
rb_sys_fail_str(message);
|
rb_sys_fail_str(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user