[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] setsid() exception in xend



# HG changeset patch
# User Horms <horms@xxxxxxxxxxxx>
# Node ID 37d3e34dfdac009eac2bb040ff79ae711b2d50f9
# Parent  b9181b1c576fb39bb4d3b088ac3378d77163b4cc
For some reason that I can't quite put a finger on,
xend is a session leader well before the code in
SrvDaemon is called. This causes os.setsid() to
throw an exception.

This patch should be safe because the only exception
setsid should throw is if the current process is already
a session leader. So the process will either become 
a session leader, or will already be one.

Signed-Off-By: Horms <horms@xxxxxxxxxxxx>

diff -r b9181b1c576f -r 37d3e34dfdac tools/python/xen/xend/server/SrvDaemon.py
--- a/tools/python/xen/xend/server/SrvDaemon.py Sat Nov 26 01:21:55 2005
+++ b/tools/python/xen/xend/server/SrvDaemon.py Sat Nov 26 11:37:18 2005
@@ -123,8 +123,12 @@
 
     def daemonize(self):
         if not XEND_DAEMONIZE: return
-        # Detach from TTY.
-        os.setsid()
+       # Detach from TTY
+       try:
+               os.setsid()
+       except:
+               # Already a session leader
+               pass
 
         # Detach from standard file descriptors, and redirect them to
         # /dev/null or the log as appropriate.


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.