Incorrect handling of stdin/stdout/stderr during daemon creation
Resolves: #695480 Signed-off-by: Jan Vcelak <jvcelak@redhat.com>
This commit is contained in:
parent
53ad121de8
commit
ccecd6fa7d
1 changed files with 6 additions and 1 deletions
7
tuned
7
tuned
|
|
@ -60,7 +60,12 @@ def daemonize():
|
||||||
log.cricital("Cannot fork: %s", str(e))
|
log.cricital("Cannot fork: %s", str(e))
|
||||||
sys.exit(1)
|
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__":
|
if __name__ == "__main__":
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue