summaryrefslogtreecommitdiff
path: root/lib/chef/resource.rb
diff options
context:
space:
mode:
authorPete Higgins <pete@peterhiggins.org>2020-06-16 10:18:44 -0700
committerPete Higgins <pete@peterhiggins.org>2020-06-16 16:45:26 -0700
commit3144cdf8e2041ee3dde162a6ba62d852500919b2 (patch)
tree5528d826e805cf29245f63ea456a6715b6d2e226 /lib/chef/resource.rb
parent164e0a8e87f35b1752d2d3b4db58accdb7ac3a91 (diff)
downloadchef-3144cdf8e2041ee3dde162a6ba62d852500919b2.tar.gz
Simplify with_umask code.
Signed-off-by: Pete Higgins <pete@peterhiggins.org>
Diffstat (limited to 'lib/chef/resource.rb')
-rw-r--r--lib/chef/resource.rb15
1 files changed, 4 insertions, 11 deletions
diff --git a/lib/chef/resource.rb b/lib/chef/resource.rb
index fb743a18d2..872d0184db 100644
--- a/lib/chef/resource.rb
+++ b/lib/chef/resource.rb
@@ -618,17 +618,10 @@ class Chef
end
def with_umask
- if umask.nil?
- yield
- return
- end
-
- old_value = ::File.umask(umask.oct)
- begin
- yield
- ensure
- ::File.umask(old_value)
- end
+ old_value = ::File.umask(umask.oct) if umask
+ yield
+ ensure
+ ::File.umask(old_value) if umask
end
#