[tuned/f17] Added cloexec patch

Jaroslav Škarvada jskarvad at fedoraproject.org
Wed Jan 2 15:36:22 UTC 2013


commit ce6d98c87ba0d5be467ff3b91936f7e13518cb6b
Author: Jaroslav Škarvada <jskarvad at redhat.com>
Date:   Wed Jan 2 16:35:15 2013 +0100

    Added cloexec patch

 tuned-2.0.1-cloexec.patch |   60 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 60 insertions(+), 0 deletions(-)
---
diff --git a/tuned-2.0.1-cloexec.patch b/tuned-2.0.1-cloexec.patch
new file mode 100644
index 0000000..024f022
--- /dev/null
+++ b/tuned-2.0.1-cloexec.patch
@@ -0,0 +1,60 @@
+diff --git a/tuned/plugins/plugin_script.py b/tuned/plugins/plugin_script.py
+index 28c361a..c1cad1c 100644
+--- a/tuned/plugins/plugin_script.py
++++ b/tuned/plugins/plugin_script.py
+@@ -42,7 +42,7 @@ class ScriptPlugin(tuned.plugins.Plugin):
+ 		for script in self._scripts:
+ 			log.info("Calling script %s" % (script))
+ 			try:
+-				proc = Popen([script, arg], stdout=PIPE, stderr=PIPE)
++				proc = Popen([script, arg], stdout=PIPE, stderr=PIPE, close_fds=True)
+ 				out, err = proc.communicate()
+ 
+ 				if proc.returncode:
+diff --git a/tuned/plugins/plugin_sysctl.py b/tuned/plugins/plugin_sysctl.py
+index 6eace81..a1b2eeb 100644
+--- a/tuned/plugins/plugin_sysctl.py
++++ b/tuned/plugins/plugin_sysctl.py
+@@ -44,9 +44,9 @@ class SysctlPlugin(tuned.plugins.Plugin):
+ 	def _exec_sysctl(self, data, write = False):
+ 		if write:
+ 			log.debug("Setting sysctl: %s" % (data))
+-			proc = Popen(["/sbin/sysctl", "-q", "-w", data], stdout=PIPE, stderr=PIPE)
++			proc = Popen(["/sbin/sysctl", "-q", "-w", data], stdout=PIPE, stderr=PIPE, close_fds=True)
+ 		else:
+-			proc = Popen(["/sbin/sysctl", "-e", data], stdout=PIPE, stderr=PIPE)
++			proc = Popen(["/sbin/sysctl", "-e", data], stdout=PIPE, stderr=PIPE, close_fds=True)
+ 		out, err = proc.communicate()
+ 
+ 		if proc.returncode:
+diff --git a/tuned/utils/nettool.py b/tuned/utils/nettool.py
+index 676efca..28fdf89 100644
+--- a/tuned/utils/nettool.py
++++ b/tuned/utils/nettool.py
+@@ -57,13 +57,13 @@ class Nettool:
+ 		if not self.supported_autoneg:
+ 			return False
+ 
+-		return 0 == call(["ethtool", "-s", self._interface, "autoneg", "on" if enable else "off"])
++		return 0 == call(["ethtool", "-s", self._interface, "autoneg", "on" if enable else "off"], close_fds=True)
+ 
+ 	def _set_advertise(self, value):
+ 		if not self._set_autonegotiation(True):
+ 			return False
+ 
+-		return 0 == call(["ethtool", "-s", self._interface, "advertise", "0x%03x" % value])
++		return 0 == call(["ethtool", "-s", self._interface, "advertise", "0x%03x" % value], close_fds=True)
+ 
+ 	def get_max_speed(self):
+ 		max = 0
+@@ -113,8 +113,8 @@ class Nettool:
+ 
+ 		# run ethtool and preprocess output
+ 
+-		p_ethtool = Popen(["ethtool", self._interface], stdout=PIPE, stderr=PIPE)
+-		p_filter = Popen(["sed", "s/^\s*//;s/:\s*/:\\n/g"], stdin=p_ethtool.stdout, stdout=PIPE)
++		p_ethtool = Popen(["ethtool", self._interface], stdout=PIPE, stderr=PIPE, close_fds=True)
++		p_filter = Popen(["sed", "s/^\s*//;s/:\s*/:\\n/g"], stdin=p_ethtool.stdout, stdout=PIPE, close_fds=True)
+ 
+ 		output = p_filter.communicate()[0]
+ 		errors = p_ethtool.communicate()[1]


More information about the scm-commits mailing list