From 443c94eb3925231d6d0167d5ccb7fab335038a9e Mon Sep 17 00:00:00 2001 From: David Wilson Date: Sun, 25 Mar 2018 12:34:39 +0545 Subject: [PATCH] issue #155: core: prevent set_cloexec() use on standard handles --- mitogen/core.py | 1 + 1 file changed, 1 insertion(+) diff --git a/mitogen/core.py b/mitogen/core.py index e43ecb42..38adabce 100644 --- a/mitogen/core.py +++ b/mitogen/core.py @@ -185,6 +185,7 @@ def is_blacklisted_import(importer, fullname): def set_cloexec(fd): flags = fcntl.fcntl(fd, fcntl.F_GETFD) + assert fd > 2 fcntl.fcntl(fd, fcntl.F_SETFD, flags | fcntl.FD_CLOEXEC)