summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRicky Zhou <ricky@fedoraproject.org>2009-07-11 01:57:52 -0400
committerJames Turnbull <james@lovedthanlost.net>2009-07-16 21:24:51 +1000
commit910a5e2f39d2fefab28768f2a2d3d02de7abd54d (patch)
treea4bca8b6c5e55b6220fdf74bd13a7981185d3c1a /lib
parentba824e94fd0c7652b9b7bb7878f76a935dc7927d (diff)
downloadpuppet-910a5e2f39d2fefab28768f2a2d3d02de7abd54d.tar.gz
puppet-910a5e2f39d2fefab28768f2a2d3d02de7abd54d.tar.xz
puppet-910a5e2f39d2fefab28768f2a2d3d02de7abd54d.zip
Fix #1963 - Failing to read /proc/mounts for selinux kills file downloads
This works around a linux kernel bug that causes a select() on /proc/mounts to hang.
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/util/selinux.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/puppet/util/selinux.rb b/lib/puppet/util/selinux.rb
index 7be119c6f..fdd40a66f 100644
--- a/lib/puppet/util/selinux.rb
+++ b/lib/puppet/util/selinux.rb
@@ -152,9 +152,15 @@ module Puppet::Util::SELinux
# Internal helper function to read and parse /proc/mounts
def read_mounts
+ mounts = ""
begin
- mountfh = File.open("/proc/mounts", File::NONBLOCK)
- mounts = mountfh.read
+ mountfh = File.open("/proc/mounts")
+ # We use read_nonblock() in a loop rather than read() to work-around
+ # a linux kernel bug. See ticket #1963 for details.
+ while true
+ mounts += mountfh.read_nonblock(1024)
+ end
+ rescue EOFError
mountfh.close
rescue
return nil