mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/socket/extconf.rb: check getpeereid.
* ext/socket/basicsocket.c (bsock_getpeereid): new method. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22219 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b8147c444b
commit
b4e50055c3
4 changed files with 59 additions and 0 deletions
|
@ -384,4 +384,18 @@ class TestUNIXSocket < Test::Unit::TestCase
|
|||
}
|
||||
end
|
||||
|
||||
def test_getpeereid
|
||||
Dir.mktmpdir {|d|
|
||||
path = "#{d}/sock"
|
||||
serv = Socket.unix_server_socket(path)
|
||||
c = Socket.unix(path)
|
||||
s, = serv.accept
|
||||
begin
|
||||
assert_equal([Process.euid, Process.egid], c.getpeereid)
|
||||
assert_equal([Process.euid, Process.egid], s.getpeereid)
|
||||
rescue NotImplementedError
|
||||
end
|
||||
}
|
||||
end
|
||||
|
||||
end if defined?(UNIXSocket) && /cygwin/ !~ RUBY_PLATFORM
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue