1
0
Fork 0

Incorrect handling of stdin/stdout/stderr during daemon creation

Resolves: #695480
Signed-off-by: Jan Vcelak <jvcelak@redhat.com>
This commit is contained in:
Phil Knirsch 2011-06-21 13:46:01 +02:00 committed by Jan Vcelak
parent 53ad121de8
commit ccecd6fa7d

7
tuned
View file

@ -60,7 +60,12 @@ def daemonize():
log.cricital("Cannot fork: %s", str(e))
sys.exit(1)
sys.stdout = sys.stderr = open("/dev/null", 'a+')
si = file('/dev/null', 'r')
so = file('/dev/null', 'a+')
se = file('/dev/null', 'a+', 0)
os.dup2(si.fileno(), sys.stdin.fileno())
os.dup2(so.fileno(), sys.stdout.fileno())
os.dup2(se.fileno(), sys.stderr.fileno())
if __name__ == "__main__":
try: