зеркало из https://github.com/github/ruby.git
* ext/socket/option.c (inspect_peercred): support OpenBSD-current.
patch by Jeremy Evans. [ruby-core:32240] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29206 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
83a827ac9b
Коммит
a75a467102
|
@ -1,3 +1,8 @@
|
|||
Fri Sep 10 02:15:29 2010 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* ext/socket/option.c (inspect_peercred): support OpenBSD-current.
|
||||
patch by Jeremy Evans. [ruby-core:32240]
|
||||
|
||||
Thu Sep 9 23:25:53 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* vm.c (vm_backtrace_each): skip allocator frames which have no
|
||||
|
|
|
@ -396,13 +396,18 @@ inspect_timeval_as_interval(int level, int optname, VALUE data, VALUE ret)
|
|||
}
|
||||
}
|
||||
|
||||
#if defined(SOL_SOCKET) && defined(SO_PEERCRED) /* GNU/Linux */
|
||||
#if defined(SOL_SOCKET) && defined(SO_PEERCRED) /* GNU/Linux, OpenBSD */
|
||||
#if defined(__OpenBSD__)
|
||||
#define RUBY_SOCK_PEERCRED struct sockpeercred
|
||||
#else
|
||||
#define RUBY_SOCK_PEERCRED struct ucred
|
||||
#endif
|
||||
static int
|
||||
inspect_peercred(int level, int optname, VALUE data, VALUE ret)
|
||||
{
|
||||
if (RSTRING_LEN(data) == sizeof(struct ucred)) {
|
||||
struct ucred cred;
|
||||
memcpy(&cred, RSTRING_PTR(data), sizeof(struct ucred));
|
||||
if (RSTRING_LEN(data) == sizeof(RUBY_SOCK_PEERCRED)) {
|
||||
RUBY_SOCK_PEERCRED cred;
|
||||
memcpy(&cred, RSTRING_PTR(data), sizeof(RUBY_SOCK_PEERCRED));
|
||||
rb_str_catf(ret, " pid=%u euid=%u egid=%u",
|
||||
(unsigned)cred.pid, (unsigned)cred.uid, (unsigned)cred.gid);
|
||||
rb_str_cat2(ret, " (ucred)");
|
||||
|
@ -569,7 +574,7 @@ sockopt_inspect(VALUE self)
|
|||
# if defined(SO_SNDTIMEO) /* POSIX */
|
||||
case SO_SNDTIMEO: inspected = inspect_timeval_as_interval(level, optname, data, ret); break;
|
||||
# endif
|
||||
# if defined(SO_PEERCRED) /* GNU/Linux */
|
||||
# if defined(SO_PEERCRED) /* GNU/Linux, OpenBSD */
|
||||
case SO_PEERCRED: inspected = inspect_peercred(level, optname, data, ret); break;
|
||||
# endif
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче