All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] setsid() exception in xend
@ 2005-11-26 11:43 Horms
  2005-11-28  4:29 ` Horms
  0 siblings, 1 reply; 9+ messages in thread
From: Horms @ 2005-11-26 11:43 UTC (permalink / raw)
  To: xen-devel


# HG changeset patch
# User Horms <horms@verge.net.au>
# 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@verge.net.au>

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.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2005-11-30  2:34 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-26 11:43 [PATCH] setsid() exception in xend Horms
2005-11-28  4:29 ` Horms
2005-11-28 11:31   ` Ewan Mellor
2005-11-28 12:53     ` Horms
2005-11-28 13:37       ` Ewan Mellor
2005-11-28 13:58         ` Horms
2005-11-28 15:57           ` Ewan Mellor
2005-11-29  1:51             ` Horms
2005-11-30  2:34             ` Horms

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.