1
0
Fork 0
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:
Nobuyoshi Nakada 2020-05-06 12:45:01 +09:00
parent 039a8ef786
commit 7397b9f786
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6

View file

@ -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