Be more considerate to future me.

Sergey points out that its more proper to |= with the current value of
the fd flags. I concur.
This commit is contained in:
Paul J. Davis 2010-03-15 22:59:26 -04:00
parent 09b5dd2ad1
commit 61a84eece3

View File

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