openbsd-ports/lang/ruby/1.9/patches/patch-ext_socket_option_c
jeremy 3a030020ea Split the lang/ruby port into separate ports for ruby 1.8 and ruby
1.9, similar to how the lang/python ports are handled.  ruby 1.8
now installs as ruby18 and ruby 1.9 installs as ruby19.  The
included MESSAGE files for both ports let you know the symlinks to
set up if you want to make that version the default system ruby.

Split port originally started by bernd@, many changes since by me,
help and support from jcs@, landry@, jasper@, and sthen@.

This causes a large amount of fallout in dependent ruby ports,
which will be committed shortly.

OK jcs@, landry@, jasper@, sthen@
2010-09-23 21:58:50 +00:00

28 lines
1.0 KiB
Plaintext

$OpenBSD: patch-ext_socket_option_c,v 1.1 2010/09/23 21:58:50 jeremy Exp $
Make inspect_peercred work on OpenBSD. Backported from r29206.
--- ext/socket/option.c.orig Wed Sep 8 18:24:28 2010
+++ ext/socket/option.c Wed Sep 8 18:25:25 2010
@@ -397,12 +397,17 @@ inspect_timeval_as_interval(int level, int optname, VA
}
#if defined(SOL_SOCKET) && defined(SO_PEERCRED) /* GNU/Linux */
+#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)");