blob: 4c22b7972186009dcfe65ba08246ded2f7653f34 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
From 0ce5b22a45d675de6969f3f5e5d4565be0a2d2d1 Mon Sep 17 00:00:00 2001
From: Ricky Zhou <ricky@fedoraproject.org>
Date: Sat, 11 Jul 2009 01:57:52 -0400
Subject: [PATCH/puppet] 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.
---
lib/puppet/util/selinux.rb | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/lib/puppet/util/selinux.rb b/lib/puppet/util/selinux.rb
index cd3b2ac..dc5daec 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", 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
--
1.6.3.3
|