* ext/socket/raddrinfo (rsock_unix_sockaddr_len): renamed from
rsock_unixpath_len, because it returns not the length of the path, but the length of a socket address for the path. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
6b36e95851
commit
07e9f122a9
@ -1,3 +1,9 @@
|
|||||||
|
Sat Jan 26 08:29:33 2013 Shugo Maeda <shugo@ruby-lang.org>
|
||||||
|
|
||||||
|
* ext/socket/raddrinfo (rsock_unix_sockaddr_len): renamed from
|
||||||
|
rsock_unixpath_len, because it returns not the length of the path,
|
||||||
|
but the length of a socket address for the path.
|
||||||
|
|
||||||
Sat Jan 26 01:12:23 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
Sat Jan 26 01:12:23 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||||
|
|
||||||
* test/ruby/test_io.rb (test_ioctl_linux): skip if a platform is
|
* test/ruby/test_io.rb (test_ioctl_linux): skip if a platform is
|
||||||
|
@ -443,7 +443,7 @@ rsock_unixaddr(struct sockaddr_un *sockaddr, socklen_t len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
socklen_t
|
socklen_t
|
||||||
rsock_unixpath_len(VALUE path)
|
rsock_unix_sockaddr_len(VALUE path)
|
||||||
{
|
{
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
if (RSTRING_PTR(path)[0] == '\0') {
|
if (RSTRING_PTR(path)[0] == '\0') {
|
||||||
@ -800,7 +800,7 @@ init_unix_addrinfo(rb_addrinfo_t *rai, VALUE path, int socktype)
|
|||||||
un.sun_family = AF_UNIX;
|
un.sun_family = AF_UNIX;
|
||||||
memcpy((void*)&un.sun_path, RSTRING_PTR(path), RSTRING_LEN(path));
|
memcpy((void*)&un.sun_path, RSTRING_PTR(path), RSTRING_LEN(path));
|
||||||
|
|
||||||
len = rsock_unixpath_len(path);
|
len = rsock_unix_sockaddr_len(path);
|
||||||
init_addrinfo(rai, (struct sockaddr *)&un, len,
|
init_addrinfo(rai, (struct sockaddr *)&un, len,
|
||||||
PF_UNIX, socktype, 0, Qnil, Qnil);
|
PF_UNIX, socktype, 0, Qnil, Qnil);
|
||||||
}
|
}
|
||||||
|
@ -240,7 +240,7 @@ int rsock_revlookup_flag(VALUE revlookup, int *norevlookup);
|
|||||||
#ifdef HAVE_SYS_UN_H
|
#ifdef HAVE_SYS_UN_H
|
||||||
VALUE rsock_unixpath_str(struct sockaddr_un *sockaddr, socklen_t len);
|
VALUE rsock_unixpath_str(struct sockaddr_un *sockaddr, socklen_t len);
|
||||||
VALUE rsock_unixaddr(struct sockaddr_un *sockaddr, socklen_t len);
|
VALUE rsock_unixaddr(struct sockaddr_un *sockaddr, socklen_t len);
|
||||||
socklen_t rsock_unixpath_len(VALUE path);
|
socklen_t rsock_unix_sockaddr_len(VALUE path);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int rsock_socket(int domain, int type, int proto);
|
int rsock_socket(int domain, int type, int proto);
|
||||||
|
@ -46,7 +46,7 @@ rsock_init_unixsock(VALUE sock, VALUE path, int server)
|
|||||||
RSTRING_LEN(path), (int)sizeof(sockaddr.sun_path));
|
RSTRING_LEN(path), (int)sizeof(sockaddr.sun_path));
|
||||||
}
|
}
|
||||||
memcpy(sockaddr.sun_path, RSTRING_PTR(path), RSTRING_LEN(path));
|
memcpy(sockaddr.sun_path, RSTRING_PTR(path), RSTRING_LEN(path));
|
||||||
sockaddrlen = rsock_unixpath_len(path);
|
sockaddrlen = rsock_unix_sockaddr_len(path);
|
||||||
|
|
||||||
if (server) {
|
if (server) {
|
||||||
status = bind(fd, (struct sockaddr*)&sockaddr, sockaddrlen);
|
status = bind(fd, (struct sockaddr*)&sockaddr, sockaddrlen);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user