Fix close_on_exec bug.

Reported by Sergey Shepelev. I changed his patch slightly because of the
man page language. As I read things, the close on exec flag is separate
from the F_SETFL flags.
This commit is contained in:
Paul J. Davis 2010-03-15 22:12:54 -04:00
parent 562c9a2d70
commit 09b5dd2ad1
2 changed files with 3 additions and 3 deletions

3
THANKS
View File

@ -7,4 +7,5 @@ suggesting improvements or submitting changes. Some of these people are:
Curt Micol <asenchi@asenchi.com>
Eric Florenzano <floguy@gmail.com>
Johan Bergström <bugs@bergstroem.nu>
Xavier Grangier <grangier@gmail.com>
Xavier Grangier <grangier@gmail.com>
Sergey Shepelev <temotor@gmail.com>

View File

@ -76,8 +76,7 @@ def get_maxfd():
return maxfd
def close_on_exec(fd):
flags = fcntl.fcntl(fd, fcntl.F_GETFD) | fcntl.FD_CLOEXEC
fcntl.fcntl(fd, fcntl.F_SETFL, flags)
fcntl.fcntl(fd, fcntl.F_SETFD, fcntl.FD_CLOEXEC)
def set_non_blocking(fd):
flags = fcntl.fcntl(fd, fcntl.F_GETFL) | os.O_NONBLOCK