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
|
def test_getcred_xucred
|
||||||
return if /freebsd|darwin/ !~ RUBY_PLATFORM
|
return if /freebsd|darwin/ !~ RUBY_PLATFORM
|
||||||
Dir.mktmpdir {|d|
|
Dir.mktmpdir do |d|
|
||||||
sockpath = "#{d}/sock"
|
sockpath = "#{d}/sock"
|
||||||
serv = Socket.unix_server_socket(sockpath)
|
serv = Socket.unix_server_socket(sockpath)
|
||||||
Socket.unix(sockpath)
|
u = Socket.unix(sockpath)
|
||||||
s, = serv.accept
|
s, = serv.accept
|
||||||
cred = s.getsockopt(0, Socket::LOCAL_PEERCRED)
|
cred = s.getsockopt(0, Socket::LOCAL_PEERCRED)
|
||||||
inspect = cred.inspect
|
inspect = cred.inspect
|
||||||
assert_match(/ euid=#{Process.euid} /, inspect)
|
assert_match(/ euid=#{Process.euid} /, inspect)
|
||||||
assert_match(/ \(xucred\)/, inspect)
|
assert_match(/ \(xucred\)/, inspect)
|
||||||
}
|
ensure
|
||||||
|
s&.close
|
||||||
|
u&.close
|
||||||
|
serv&.close
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_sendcred_ucred
|
def test_sendcred_ucred
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue