diff options
author | (no author) <(no author)@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1999-02-24 04:31:29 +0000 |
---|---|---|
committer | (no author) <(no author)@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1999-02-24 04:31:29 +0000 |
commit | 831aa6cd961ce56ef248d3a078db4f75c5d2bf6b (patch) | |
tree | cb461ab9246a2c8e13d373a8c2d2e6378e4db9cc /lib/tempfile.rb | |
parent | 62e648e148b3cb9f96dcce808c55c02b7ccb4486 (diff) |
This commit was manufactured by cvs2svn to create tag
'v1_3_1_990224'.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/tags/v1_3_1_990224@406 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/tempfile.rb')
-rw-r--r-- | lib/tempfile.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/tempfile.rb b/lib/tempfile.rb index bf51ac2788..ed376a5032 100644 --- a/lib/tempfile.rb +++ b/lib/tempfile.rb @@ -28,13 +28,14 @@ class Tempfile < SimpleDelegator } end - def initialize(basename, tmpdir = '/tmp') + def initialize(basename, tmpdir = nil) umask = File.umask(0177) tmpname = lock = nil begin n = 0 while true begin + tmpdir ||= ENV['TMPDIR'] || ENV['TMP'] || ENV['TEMP'] || '/tmp' tmpname = sprintf('%s/%s.%d.%d', tmpdir, basename, $$, n) lock = tmpname + '.lock' unless File.exist?(lock) |