mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/socket/option.c (inspect_local_peercred): check version.
(sockopt_inspect): suppress warning. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22145 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
64f12a46d5
commit
70f7660196
2 changed files with 11 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
|||
Mon Feb 9 09:05:12 2009 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* ext/socket/option.c (inspect_local_peercred): check version.
|
||||
(sockopt_inspect): suppress warning.
|
||||
|
||||
Mon Feb 9 02:04:03 2009 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* ext/socket/option.c (inspect_peercred): struct ucred contains
|
||||
|
|
|
@ -263,6 +263,8 @@ inspect_local_peercred(int level, int optname, VALUE data, VALUE ret)
|
|||
if (RSTRING_LEN(data) == sizeof(struct xucred)) {
|
||||
struct xucred cred;
|
||||
memcpy(&cred, RSTRING_PTR(data), sizeof(struct xucred));
|
||||
if (cred.cr_version != XUCRED_VERSION)
|
||||
return -1;
|
||||
rb_str_catf(ret, " version=%u", cred.cr_version);
|
||||
rb_str_catf(ret, " euid=%u", cred.cr_uid);
|
||||
if (cred.cr_ngroups) {
|
||||
|
@ -330,6 +332,7 @@ sockopt_inspect(VALUE self)
|
|||
if (optname == LOCAL_PEERCRED) {
|
||||
if (inspect_local_peercred(level, optname, data, ret) == -1) goto dump;
|
||||
goto finish;
|
||||
#define USE_FINISH 1
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
@ -437,7 +440,10 @@ sockopt_inspect(VALUE self)
|
|||
rb_str_catf(ret, " %s", StringValueCStr(data));
|
||||
}
|
||||
|
||||
#ifdef USE_FINISH
|
||||
finish:
|
||||
#endif
|
||||
#undef USE_FINISH
|
||||
rb_str_cat2(ret, ">");
|
||||
|
||||
return ret;
|
||||
|
|
Loading…
Reference in a new issue