diff options
author | Dean Perkins <dean.perkins@iag.com.au> | 2017-06-28 14:50:10 +1000 |
---|---|---|
committer | Dean Perkins <dean.perkins@iag.com.au> | 2017-06-28 14:50:10 +1000 |
commit | 9388ef361eb754ae3ff6b765f2086205cd070401 (patch) | |
tree | af41e424579cf3c048acd559bc632f624e000145 | |
parent | f80d9775f0c64933019f9bb2f7621455ed5b5a54 (diff) | |
download | ptyprocess-9388ef361eb754ae3ff6b765f2086205cd070401.tar.gz |
Fix AIX bug for users with unlimited nofiles
-rw-r--r-- | ptyprocess/ptyprocess.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/ptyprocess/ptyprocess.py b/ptyprocess/ptyprocess.py index cb3efae..fb8e351 100644 --- a/ptyprocess/ptyprocess.py +++ b/ptyprocess/ptyprocess.py @@ -251,7 +251,10 @@ class PtyProcess(object): # Do not allow child to inherit open file descriptors from parent, # with the exception of the exec_err_pipe_write of the pipe - max_fd = resource.getrlimit(resource.RLIMIT_NOFILE)[0] + # Impose ceiling on max_fd: AIX bugfix for users with unlimited + # nofiles where resource.RLIMIT_NOFILE is 2^63-1 and os.closerange() + # occasionally raises out of range error + max_fd = min(1048576, resource.getrlimit(resource.RLIMIT_NOFILE)[0]) os.closerange(3, exec_err_pipe_write) os.closerange(exec_err_pipe_write+1, max_fd) |