# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Node ID 5db6984e4503a6ddf2cb0db58c5af189d70f1f78
# Parent fdc4531aefe06f7092e6c2113be76cbefaf77bf2
Set the close-on-exec flag on the RPC socket in tool stack.
Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
---
tools/python/xen/util/xmlrpclib2.py | 12 ++++++++++++
tools/python/xen/web/httpserver.py | 7 +++++++
2 files changed, 19 insertions(+)
diff -r fdc4531aefe0 -r 5db6984e4503 tools/python/xen/util/xmlrpclib2.py
--- a/tools/python/xen/util/xmlrpclib2.py Tue Aug 15 16:25:39 2006 +0100
+++ b/tools/python/xen/util/xmlrpclib2.py Tue Aug 15 16:26:39 2006 +0100
@@ -22,6 +22,7 @@ An enhanced XML-RPC client/server interf
import string
import types
+import fcntl
from httplib import HTTPConnection, HTTP
from xmlrpclib import Transport
@@ -136,6 +137,17 @@ class TCPXMLRPCServer(SocketServer.Threa
logRequests=1):
SimpleXMLRPCServer.__init__(self, addr, requestHandler, logRequests)
+ flags = fcntl.fcntl(self.fileno(), fcntl.F_GETFD)
+ flags |= fcntl.FD_CLOEXEC
+ fcntl.fcntl(self.fileno(), fcntl.F_SETFD, flags)
+
+ def get_request(self):
+ (client, addr) = SimpleXMLRPCServer.get_request(self)
+ flags = fcntl.fcntl(client.fileno(), fcntl.F_GETFD)
+ flags |= fcntl.FD_CLOEXEC
+ fcntl.fcntl(client.fileno(), fcntl.F_SETFD, flags)
+ return (client, addr)
+
def _marshaled_dispatch(self, data, dispatch_method = None):
params, method = xmlrpclib.loads(data)
if False:
diff -r fdc4531aefe0 -r 5db6984e4503 tools/python/xen/web/httpserver.py
--- a/tools/python/xen/web/httpserver.py Tue Aug 15 16:25:39 2006 +0100
+++ b/tools/python/xen/web/httpserver.py Tue Aug 15 16:26:39 2006 +0100
@@ -24,6 +24,7 @@ from urllib import quote, unquote
from urllib import quote, unquote
import os
import os.path
+import fcntl
from xen.xend import sxp
from xen.xend.Args import ArgError
@@ -294,6 +295,9 @@ class HttpServer:
def bind(self):
self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ flags = fcntl.fcntl(self.socket.fileno(), fcntl.F_GETFD)
+ flags |= fcntl.FD_CLOEXEC
+ fcntl.fcntl(self.socket.fileno(), fcntl.F_SETFD, flags)
self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
self.socket.bind((self.interface, self.port))
@@ -338,3 +342,6 @@ class UnixHttpServer(HttpServer):
def bind(self):
self.socket = unix.bind(self.path)
+ flags = fcntl.fcntl(self.socket.fileno(), fcntl.F_GETFD)
+ flags |= fcntl.FD_CLOEXEC
+ fcntl.fcntl(self.socket.fileno(), fcntl.F_SETFD, flags)
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|