summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-03-28 14:34:14 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-03-28 14:34:14 +0000
commite9ddf2ba41a0bffe1047e33576affd48808c5d0b (patch)
tree47986903ce72c37e03c19679a92aa2a3cbf35b85 /lib
parent143eb22f1877815dd802f7928959c5f93d4c7bb3 (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_2@63017 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 494725cb33..95f20e984c 100644
--- a/lib/tmpdir.rb
+++ b/lib/tmpdir.rb
@@ -108,8 +108,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)}"
path << "-#{n}" if n