summaryrefslogtreecommitdiff
path: root/lib/chef/provider/file
diff options
context:
space:
mode:
authorLamont Granquist <lamont@opscode.com>2013-04-11 14:31:08 -0700
committerLamont Granquist <lamont@opscode.com>2013-04-11 14:31:08 -0700
commit63beb4881bca18ae436afac77a96e55822f9a214 (patch)
treea3e99d9df467ddc321a69d847ecd1687b6f5749e /lib/chef/provider/file
parent6d0627dd52d69ee559a0d503c678fb1a9575a0b3 (diff)
downloadchef-63beb4881bca18ae436afac77a96e55822f9a214.tar.gz
ruby-1.8.7 fix
Diffstat (limited to 'lib/chef/provider/file')
-rw-r--r--lib/chef/provider/file/tempfile.rb16
1 files changed, 7 insertions, 9 deletions
diff --git a/lib/chef/provider/file/tempfile.rb b/lib/chef/provider/file/tempfile.rb
index 42c4862159..af98e2e4d7 100644
--- a/lib/chef/provider/file/tempfile.rb
+++ b/lib/chef/provider/file/tempfile.rb
@@ -30,11 +30,17 @@ class Chef
end
def tempfile
- @tempfile ||= ::Tempfile.open(tempfile_basename, tempfile_dirname, tempfile_flags)
+ @tempfile ||= tempfile_open
end
private
+ def tempfile_open
+ tf = ::Tempfile.open(tempfile_basename, tempfile_dirname)
+ tf.binmode if new_resource.binmode
+ tf
+ end
+
#
# These are important for windows to get permissions right, and may
# be useful for SELinux and other ACL approaches. Please use them
@@ -49,14 +55,6 @@ class Chef
def tempfile_dirname
Chef::Config[:file_deployment_uses_destdir] ? ::File.dirname(@new_resource.path) : Dir::tmpdir
end
-
- def tempfile_flags
- if new_resource.binmode
- { :binmode => true }
- else
- {}
- end
- end
end
end
end