From a956aa409eafef58e5c3585973a61652f9aff540 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Fri, 23 Mar 2018 12:41:31 +0545 Subject: [PATCH] Remove duplicate set_cloexec calls everywhere Now it's handled in Side() constructor, it can disappear elsewhere. --- mitogen/core.py | 4 ---- mitogen/fakessh.py | 1 - mitogen/unix.py | 3 --- 3 files changed, 8 deletions(-) diff --git a/mitogen/core.py b/mitogen/core.py index 9e4f8268..7be47714 100644 --- a/mitogen/core.py +++ b/mitogen/core.py @@ -844,8 +844,6 @@ class Stream(BasicStream): # TODO: what is this os.dup for? self.receive_side = Side(self, os.dup(rfd)) self.transmit_side = Side(self, os.dup(wfd)) - set_cloexec(self.receive_side.fd) - set_cloexec(self.transmit_side.fd) def __repr__(self): cls = type(self) @@ -1025,8 +1023,6 @@ class Waker(BasicStream): def __init__(self, broker): self._broker = broker rfd, wfd = os.pipe() - set_cloexec(rfd) - set_cloexec(wfd) self.receive_side = Side(self, rfd) self.transmit_side = Side(self, wfd) diff --git a/mitogen/fakessh.py b/mitogen/fakessh.py index 25f35149..be3a2539 100644 --- a/mitogen/fakessh.py +++ b/mitogen/fakessh.py @@ -322,7 +322,6 @@ def run(dest, router, args, deadline=None, econtext=None): fakessh.name = 'fakessh.%d' % (context_id,) sock1, sock2 = socket.socketpair() - mitogen.core.set_cloexec(sock1.fileno()) stream = mitogen.core.Stream(router, context_id) stream.name = 'fakessh' diff --git a/mitogen/unix.py b/mitogen/unix.py index d62a96a8..dad71ff9 100644 --- a/mitogen/unix.py +++ b/mitogen/unix.py @@ -74,9 +74,6 @@ class Listener(mitogen.core.BasicStream): self._sock.bind(self.path) os.chmod(self.path, 0600) self._sock.listen(backlog) - mitogen.core.set_nonblock(self._sock.fileno()) - mitogen.core.set_cloexec(self._sock.fileno()) - self.path = self._sock.getsockname() self.receive_side = mitogen.core.Side(self, self._sock.fileno()) router.broker.start_receive(self)