mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Fixed leaked fds
This commit is contained in:
parent
039a8ef786
commit
7397b9f786
1 changed files with 7 additions and 3 deletions
|
@ -542,16 +542,20 @@ class TestSocket_UNIXSocket < Test::Unit::TestCase
|
|||
|
||||
def test_getcred_xucred
|
||||
return if /freebsd|darwin/ !~ RUBY_PLATFORM
|
||||
Dir.mktmpdir {|d|
|
||||
Dir.mktmpdir do |d|
|
||||
sockpath = "#{d}/sock"
|
||||
serv = Socket.unix_server_socket(sockpath)
|
||||
Socket.unix(sockpath)
|
||||
u = Socket.unix(sockpath)
|
||||
s, = serv.accept
|
||||
cred = s.getsockopt(0, Socket::LOCAL_PEERCRED)
|
||||
inspect = cred.inspect
|
||||
assert_match(/ euid=#{Process.euid} /, inspect)
|
||||
assert_match(/ \(xucred\)/, inspect)
|
||||
}
|
||||
ensure
|
||||
s&.close
|
||||
u&.close
|
||||
serv&.close
|
||||
end
|
||||
end
|
||||
|
||||
def test_sendcred_ucred
|
||||
|
|
Loading…
Add table
Reference in a new issue