* ext/socket/socket.c (rsock_sys_fail_path): Use rb_str_inspect only
for String to avoid SEGV. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40152 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
24ee6971cc
commit
8c6c73745e
@ -1,6 +1,11 @@
|
|||||||
|
Sat Apr 6 13:13:39 2013 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
|
* ext/socket/socket.c (rsock_sys_fail_path): Use rb_str_inspect only
|
||||||
|
for String to avoid SEGV.
|
||||||
|
|
||||||
Sat Apr 6 12:40:16 2013 Tanaka Akira <akr@fsij.org>
|
Sat Apr 6 12:40:16 2013 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* ext/socket/rubysocket.h (rsock_sys_fail_host_port) Wrap by NORETURN.
|
* ext/socket/rubysocket.h (rsock_sys_fail_host_port): Wrap by NORETURN.
|
||||||
(rsock_sys_fail_path): Ditto.
|
(rsock_sys_fail_path): Ditto.
|
||||||
(rsock_sys_fail_sockaddr): Ditto.
|
(rsock_sys_fail_sockaddr): Ditto.
|
||||||
|
|
||||||
|
@ -29,16 +29,21 @@ void
|
|||||||
rsock_sys_fail_path(const char *mesg, VALUE path)
|
rsock_sys_fail_path(const char *mesg, VALUE path)
|
||||||
{
|
{
|
||||||
VALUE message;
|
VALUE message;
|
||||||
if (memchr(RSTRING_PTR(path), '\0', RSTRING_LEN(path))) {
|
if (RB_TYPE_P(path, T_STRING)) {
|
||||||
path = rb_str_inspect(path);
|
if (memchr(RSTRING_PTR(path), '\0', RSTRING_LEN(path))) {
|
||||||
message = rb_sprintf("%s for %s", mesg,
|
path = rb_str_inspect(path);
|
||||||
StringValueCStr(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);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
message = rb_sprintf("%s for \"%s\"", mesg,
|
rb_sys_fail(mesg);
|
||||||
StringValueCStr(path));
|
|
||||||
}
|
}
|
||||||
rb_sys_fail_str(message);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
x
Reference in New Issue
Block a user