diff --git a/ChangeLog b/ChangeLog index e839f9a215..72c5ec1593 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon Feb 9 02:04:03 2009 Tanaka Akira + + * ext/socket/option.c (inspect_peercred): struct ucred contains + effective uid/gid. + Mon Feb 9 00:44:45 2009 Tanaka Akira * ext/socket/option.c (sockopt_inspect): add ifdef guard for diff --git a/ext/socket/option.c b/ext/socket/option.c index 980acda85d..36750ad6c0 100644 --- a/ext/socket/option.c +++ b/ext/socket/option.c @@ -246,7 +246,7 @@ 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)); - rb_str_catf(ret, " pid=%u uid=%u gid=%u", cred.pid, cred.uid, cred.gid); + rb_str_catf(ret, " pid=%u euid=%u egid=%u", cred.pid, cred.uid, cred.gid); rb_str_cat2(ret, " (ucred)"); return 0; } diff --git a/test/socket/test_unix.rb b/test/socket/test_unix.rb index fb0c47d348..663ad8f111 100644 --- a/test/socket/test_unix.rb +++ b/test/socket/test_unix.rb @@ -306,8 +306,8 @@ class TestUNIXSocket < Test::Unit::TestCase cred = s.getsockopt(:SOCKET, :PEERCRED) inspect = cred.inspect assert_match(/ pid=#{$$} /, inspect) - assert_match(/ uid=#{Process.uid} /, inspect) - assert_match(/ gid=#{Process.gid} /, inspect) + assert_match(/ euid=#{Process.euid} /, inspect) + assert_match(/ egid=#{Process.egid} /, inspect) assert_match(/ \(ucred\)/, inspect) } end