1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/tempfile.rb (Tempfile::initialize): got out code of

generating tmpname.  [ruby-dev:23832][ruby-dev:23837]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6598 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akira 2004-07-07 15:18:00 +00:00
parent 10b0f97ae9
commit dbc7ba14a0
2 changed files with 11 additions and 1 deletions

View file

@ -1,3 +1,8 @@
Thu Jul 8 00:05:23 2004 akira yamada <akira@ruby-lang.org>
* lib/tempfile.rb (Tempfile::initialize): got out code of
generating tmpname. [ruby-dev:23832][ruby-dev:23837]
Wed Jul 7 02:31:41 2004 Kouhei Sutou <kou@cozmixng.org>
* lib/rss/{rss,parser,0.9,1.0,2.0}.rb: supported RSS 0.9x/2.0

View file

@ -33,7 +33,7 @@ class Tempfile < DelegateClass(File)
Thread.critical = true
begin
tmpname = sprintf('%s/%s%d.%d', tmpdir, basename, $$, n)
tmpname = File.join(tmpdir, make_tmpname(basename, n))
lock = tmpname + '.lock'
n += 1
end while @@cleanlist.include?(tmpname) or
@ -66,6 +66,11 @@ class Tempfile < DelegateClass(File)
Dir.rmdir(lock)
end
def make_tmpname(basename, n)
sprintf('%s%d.%d', basename, $$, n)
end
private :make_tmpname
# Opens or reopens the file with mode "r+".
def open
@tmpfile.close if @tmpfile