Patch for certmaster/funcd daemonization

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

 



The funcd/certmaster daemonize() function doesn't close it's
stdin/stdout/stderr streams, this means that it dups() it's parent's
file descriptors, and so keeps the process leader waiting when the
parent process exits. You can see this when you ssh into a host and
start/restart funcd, closing the connection leaves the sshd hanging
waiting on funcd.

The attached patch fixes this. I'm new to git/python, so if it's broken
in some way, I'm not afraid to hear it :).

One question: when yum install'ing func from Epel for Centos5,
the certmasterd is chkconfig on and started, do the minion's need the
certmasterd daemon running or can I shut it down?
-- 
Jonathan Barber
High Performance Computing Analyst
Tel. +44 (0) 1382 386389
>From 0c0b4155a0b23f6069151ac93ae8aee1ecd22d5b Mon Sep 17 00:00:00 2001
From: Jonathan Barber <j.barber@xxxxxxxxxxxx>
Date: Fri, 5 Sep 2008 14:12:28 +0100
Subject: [PATCH] Close daemonized processes streams

Otherwise the parents are kept waiting forever for them to close.
---
 certmaster/utils.py |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/certmaster/utils.py b/certmaster/utils.py
index 588e986..eab2fee 100755
--- a/certmaster/utils.py
+++ b/certmaster/utils.py
@@ -48,6 +48,10 @@ def daemonize(pidfile=None):
     pid = os.fork()
     if pid > 0:
         sys.exit(0)
+    os.close(0)
+    os.close(1)
+    os.close(2)
+    os.cwd("/")
     os.setsid()
     os.umask(0)
     pid = os.fork()
-- 
1.5.2.1

_______________________________________________
Func-list mailing list
Func-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/func-list

[Index of Archives]     [Fedora Users]     [Linux Networking]     [Fedora Legacy List]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux