mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
merge revision(s) 63000:
unixsocket.c: abstract namespace * ext/socket/unixsocket.c (unixsock_path_value): fix r62991 for Linux abstract namespace. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@63005 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b9121fe760
commit
32c00d78a6
3 changed files with 31 additions and 2 deletions
|
@ -1,3 +1,10 @@
|
|||
Wed Mar 28 21:24:24 2018 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
unixsocket.c: abstract namespace
|
||||
|
||||
* ext/socket/unixsocket.c (unixsock_path_value): fix r62991 for
|
||||
Linux abstract namespace.
|
||||
|
||||
Wed Mar 28 19:36:24 2018 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
pack.c: fix underflow
|
||||
|
|
|
@ -25,6 +25,28 @@ unixsock_connect_internal(VALUE a)
|
|||
arg->sockaddrlen, 0);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
unixsock_path_value(VALUE path)
|
||||
{
|
||||
#ifdef __linux__
|
||||
#define TO_STR_FOR_LINUX_ABSTRACT_NAMESPACE 0
|
||||
|
||||
VALUE name = path;
|
||||
#if TO_STR_FOR_LINUX_ABSTRACT_NAMESPACE
|
||||
const int isstr = !NIL_P(name = rb_check_string_type(name));
|
||||
#else
|
||||
const int isstr = RB_TYPE_P(name, T_STRING);
|
||||
#endif
|
||||
if (isstr) {
|
||||
if (RSTRING_LEN(name) == 0 || RSTRING_PTR(name)[0] == '\0') {
|
||||
rb_check_safe_obj(name);
|
||||
return name; /* ignore encoding */
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return rb_get_path(path);
|
||||
}
|
||||
|
||||
VALUE
|
||||
rsock_init_unixsock(VALUE sock, VALUE path, int server)
|
||||
{
|
||||
|
@ -33,7 +55,7 @@ rsock_init_unixsock(VALUE sock, VALUE path, int server)
|
|||
int fd, status;
|
||||
rb_io_t *fptr;
|
||||
|
||||
FilePathValue(path);
|
||||
path = unixsock_path_value(path);
|
||||
|
||||
INIT_SOCKADDR_UN(&sockaddr, sizeof(struct sockaddr_un));
|
||||
if (sizeof(sockaddr.sun_path) < (size_t)RSTRING_LEN(path)) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#define RUBY_VERSION "2.3.7"
|
||||
#define RUBY_RELEASE_DATE "2018-03-28"
|
||||
#define RUBY_PATCHLEVEL 454
|
||||
#define RUBY_PATCHLEVEL 455
|
||||
|
||||
#define RUBY_RELEASE_YEAR 2018
|
||||
#define RUBY_RELEASE_MONTH 3
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue