Skip to content

Commit 0b6939d

Browse files
committed
Undo changes that make -R branch logic behave the same as non -R branch,
that is, to close(0) and open /dev/null as fd=0 instead of fd=3. (Partially) Revert "Ensure fd 0 stdin </dev/null is always inheritable." This partially reverts commit 7946678.
1 parent e9c4f74 commit 0b6939d

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

gunicorn/util.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -497,17 +497,13 @@ def daemonize(enable_stdio_inheritance=False):
497497
os.dup2(fd_null, 2)
498498

499499
else:
500+
fd_null = os.open(REDIRECT_TO, os.O_RDWR)
501+
500502
# Always redirect stdin to /dev/null as we would
501503
# never expect to need to read interactive input.
502504

503-
os.close(0)
504-
505-
fd_null = os.open(REDIRECT_TO, os.O_RDWR)
506-
# PEP 446, make fd for /dev/null inheritable
507-
os.set_inheritable(fd_null, True)
508-
509-
# expect fd_null to be always 0 here, but in-case not ...
510505
if fd_null != 0:
506+
os.close(0)
511507
os.dup2(fd_null, 0)
512508

513509
# If stdout and stderr are still connected to

0 commit comments

Comments
 (0)