summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordrag00n <cmlucian@us.ibm.com>2015-01-13 15:17:47 -0500
committerThom May <thom@chef.io>2016-02-16 11:24:01 +0000
commit357950127954094da7052e14edf887dbb7ed98de (patch)
tree2bccdda6532d29d9cac9b466acc16f6afda8f4a9
parent9a9e2b484ac3ac4c8497dd5e0cddff9c7c6c6dac (diff)
downloadchef-357950127954094da7052e14edf887dbb7ed98de.tar.gz
Make sure that we have a valid object before calling close!
This fixes [#2171](https://github.com/opscode/chef/issues/2171) when a tempfile cannot be created or proper filesystem permissions do not exist. This allows the proper exception to be thrown.
-rw-r--r--lib/chef/http.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/chef/http.rb b/lib/chef/http.rb
index 9cd55f18dd..a3673ce281 100644
--- a/lib/chef/http.rb
+++ b/lib/chef/http.rb
@@ -406,7 +406,7 @@ class Chef
tf.close
tf
rescue Exception
- tf.close!
+ tf.close! if tf
raise
end