ruby-changes:10588
From: akr <ko1@a...>
Date: Mon, 9 Feb 2009 09:06:52 +0900 (JST)
Subject: [ruby-changes:10588] Ruby:r22145 (trunk): * ext/socket/option.c (inspect_local_peercred): check version.
akr 2009-02-09 09:06:41 +0900 (Mon, 09 Feb 2009) New Revision: 22145 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=22145 Log: * ext/socket/option.c (inspect_local_peercred): check version. (sockopt_inspect): suppress warning. Modified files: trunk/ChangeLog trunk/ext/socket/option.c Index: ChangeLog =================================================================== --- ChangeLog (revision 22144) +++ ChangeLog (revision 22145) @@ -1,3 +1,8 @@ +Mon Feb 9 09:05:12 2009 Tanaka Akira <akr@f...> + + * ext/socket/option.c (inspect_local_peercred): check version. + (sockopt_inspect): suppress warning. + Mon Feb 9 02:04:03 2009 Tanaka Akira <akr@f...> * ext/socket/option.c (inspect_peercred): struct ucred contains Index: ext/socket/option.c =================================================================== --- ext/socket/option.c (revision 22144) +++ ext/socket/option.c (revision 22145) @@ -263,6 +263,8 @@ 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 @@ 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 @@ rb_str_catf(ret, " %s", StringValueCStr(data)); } +#ifdef USE_FINISH finish: +#endif +#undef USE_FINISH rb_str_cat2(ret, ">"); return ret; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/