summaryrefslogtreecommitdiff
path: root/lib/chef/run_lock.rb
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2013-06-20 17:27:53 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2013-06-20 17:27:53 -0700
commit523bce73dc42a524a59564deb3306de4979cc86d (patch)
tree0907df885a816ce3e12a236517fb02c50d7e6487 /lib/chef/run_lock.rb
parentc30083f59dd2860eebd7ca269f1e36837d6a58e6 (diff)
downloadchef-523bce73dc42a524a59564deb3306de4979cc86d.tar.gz
add test, bitwise arithm, note about 1.8/1.9/2.0 differences
Diffstat (limited to 'lib/chef/run_lock.rb')
-rw-r--r--lib/chef/run_lock.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/chef/run_lock.rb b/lib/chef/run_lock.rb
index 50371d93a1..7f0863e2ee 100644
--- a/lib/chef/run_lock.rb
+++ b/lib/chef/run_lock.rb
@@ -57,8 +57,9 @@ class Chef
create_path(File.dirname(runlock_file))
@runlock = File.open(runlock_file,'w+')
# if we support FD_CLOEXEC (linux, !windows), then use it.
+ # NB: ruby-2.0.0-p195 sets FD_CLOEXEC by default, but not ruby-1.8.7/1.9.3
if Fcntl.const_defined?('F_SETFD') && Fcntl.const_defined?('FD_CLOEXEC')
- @runlock.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
+ runlock.fcntl(Fcntl::F_SETFD, runlock.fcntl(Fcntl::F_GETFD, 0) | Fcntl::FD_CLOEXEC)
end
unless runlock.flock(File::LOCK_EX|File::LOCK_NB)
# Another chef client running...