diff options
author | Hleb Valoshka <375gnu@gmail.com> | 2013-09-04 15:07:19 +0300 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2013-09-04 17:29:19 +0000 |
commit | 90340eb8f2c5bf820eabd3c25fb39e45285b1c40 (patch) | |
tree | 061d89a6124252689469eaf9621895d0f90e76c2 /test/test_unix_connect.rb | |
parent | 71f656e40de99d240c873ebb23451f76e46e5a20 (diff) | |
download | kgio-90340eb8f2c5bf820eabd3c25fb39e45285b1c40.tar.gz |
[ew: this avoids a TOCTOU issue for multiple test invocations] Signed-off-by: Eric Wong <normalperson@yhbt.net>
Diffstat (limited to 'test/test_unix_connect.rb')
-rw-r--r-- | test/test_unix_connect.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/test/test_unix_connect.rb b/test/test_unix_connect.rb index 007f422..60cb8c0 100644 --- a/test/test_unix_connect.rb +++ b/test/test_unix_connect.rb @@ -3,6 +3,7 @@ require 'io/nonblock' $-w = true require 'kgio' require 'tempfile' +require 'tmpdir' class SubSocket < Kgio::Socket attr_accessor :foo @@ -14,7 +15,8 @@ end class TestKgioUnixConnect < Test::Unit::TestCase def setup - tmp = Tempfile.new('kgio_unix_1') + @tmpdir = Dir.mktmpdir('kgio_unix_1') + tmp = Tempfile.new('kgio_unix_1', @tmpdir) @path = tmp.path File.unlink(@path) tmp.close rescue nil @@ -25,6 +27,7 @@ class TestKgioUnixConnect < Test::Unit::TestCase def teardown @srv.close unless @srv.closed? File.unlink(@path) + FileUtils.remove_entry_secure(@tmpdir) Kgio.accept_cloexec = true end |