* 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
@ -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>
|
Mon Feb 9 02:04:03 2009 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* ext/socket/option.c (inspect_peercred): struct ucred contains
|
* 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)) {
|
if (RSTRING_LEN(data) == sizeof(struct xucred)) {
|
||||||
struct xucred cred;
|
struct xucred cred;
|
||||||
memcpy(&cred, RSTRING_PTR(data), sizeof(struct xucred));
|
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, " version=%u", cred.cr_version);
|
||||||
rb_str_catf(ret, " euid=%u", cred.cr_uid);
|
rb_str_catf(ret, " euid=%u", cred.cr_uid);
|
||||||
if (cred.cr_ngroups) {
|
if (cred.cr_ngroups) {
|
||||||
@ -330,6 +332,7 @@ sockopt_inspect(VALUE self)
|
|||||||
if (optname == LOCAL_PEERCRED) {
|
if (optname == LOCAL_PEERCRED) {
|
||||||
if (inspect_local_peercred(level, optname, data, ret) == -1) goto dump;
|
if (inspect_local_peercred(level, optname, data, ret) == -1) goto dump;
|
||||||
goto finish;
|
goto finish;
|
||||||
|
#define USE_FINISH 1
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
@ -437,7 +440,10 @@ sockopt_inspect(VALUE self)
|
|||||||
rb_str_catf(ret, " %s", StringValueCStr(data));
|
rb_str_catf(ret, " %s", StringValueCStr(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef USE_FINISH
|
||||||
finish:
|
finish:
|
||||||
|
#endif
|
||||||
|
#undef USE_FINISH
|
||||||
rb_str_cat2(ret, ">");
|
rb_str_cat2(ret, ">");
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user