summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-03-28 10:29:15 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-03-28 10:29:15 +0000
commita606704e84b1491ea3e490746171c4f882b683e9 (patch)
tree61dbd414743dc269d4a91f1d4f06b517ee2dd180 /lib
parent89133fafe70c7a3b5d04cf2be028e1eacc6e0447 (diff)
merge revision(s) 62990:
Ignore file separator from tmpfile/tmpdir name. From: SHIBATA Hiroshi <hsbt@ruby-lang.org> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@62995 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/tmpdir.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/tmpdir.rb b/lib/tmpdir.rb
index e4df93c2d0..61eac3ba61 100644
--- a/lib/tmpdir.rb
+++ b/lib/tmpdir.rb
@@ -109,8 +109,10 @@ class Dir
def make_tmpname((prefix, suffix), n)
prefix = (String.try_convert(prefix) or
raise ArgumentError, "unexpected prefix: #{prefix.inspect}")
+ prefix = prefix.delete("#{File::SEPARATOR}#{File::ALT_SEPARATOR}")
suffix &&= (String.try_convert(suffix) or
raise ArgumentError, "unexpected suffix: #{suffix.inspect}")
+ suffix &&= suffix.delete("#{File::SEPARATOR}#{File::ALT_SEPARATOR}")
t = Time.now.strftime("%Y%m%d")
path = "#{prefix}#{t}-#{$$}-#{rand(0x100000000).to_s(36)}".dup
path << "-#{n}" if n