summaryrefslogtreecommitdiff
path: root/lib/tempfile.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tempfile.rb')
-rw-r--r--lib/tempfile.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/tempfile.rb b/lib/tempfile.rb
index 10f05a3b2b..ab97f457a8 100644
--- a/lib/tempfile.rb
+++ b/lib/tempfile.rb
@@ -29,6 +29,9 @@ class Tempfile < SimpleDelegator
end
def initialize(basename, tmpdir=ENV['TMPDIR']||ENV['TMP']||ENV['TEMP']||'/tmp')
+ if $SAFE > 0 and tmpdir.tainted?
+ tmpdir = '/tmp'
+ end
umask = File.umask(0177)
begin
n = 0