From 2e2522ecdfc577f8c44850cf8ba616f456730cf7 Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 22 Sep 2014 04:44:19 +0000 Subject: tmpdir.rb: explicit conversion to string * lib/tmpdir.rb (Dir::Tmpname#make_tmpname): convert prefix and suffix to strings explicitly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47681 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/tmpdir.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/tmpdir.rb b/lib/tmpdir.rb index 7bd99e1fbb..f52d092de5 100644 --- a/lib/tmpdir.rb +++ b/lib/tmpdir.rb @@ -106,6 +106,10 @@ class Dir end def make_tmpname((prefix, suffix), n) + prefix = (String.try_convert(prefix) or + raise ArgumentError, "unexpected prefix: #{prefix.inspect}") + suffix &&= (String.try_convert(suffix) or + raise ArgumentError, "unexpected suffix: #{suffix.inspect}") t = Time.now.strftime("%Y%m%d") path = "#{prefix}#{t}-#{$$}-#{rand(0x100000000).to_s(36)}" path << "-#{n}" if n -- cgit v1.2.3