diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-04-02 14:24:46 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-04-02 14:24:46 (GMT) |
commit | e7c749238e8fe2a10248ae9d81b1e53153496a8d (patch) | |
tree | 00d63a98ddabff2a6fee909a7e478aee37a345ba /Modules/_posixsubprocess.c | |
parent | d223fa631d6fd2822b4cc8ec11b19f5e6d0f415d (diff) | |
download | cpython-e7c749238e8fe2a10248ae9d81b1e53153496a8d.zip cpython-e7c749238e8fe2a10248ae9d81b1e53153496a8d.tar.gz cpython-e7c749238e8fe2a10248ae9d81b1e53153496a8d.tar.bz2 |
Issue #23851: close() must not be retried when it fails with EINTR
See the PEP 475 for the rationale.
Diffstat (limited to 'Modules/_posixsubprocess.c')
-rw-r--r-- | Modules/_posixsubprocess.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Modules/_posixsubprocess.c b/Modules/_posixsubprocess.c index a8c2be2..f0a272e 100644 --- a/Modules/_posixsubprocess.c +++ b/Modules/_posixsubprocess.c @@ -207,13 +207,13 @@ _close_fds_by_brute_force(long start_fd, PyObject *py_fds_to_keep) if (keep_fd < start_fd) continue; for (fd_num = start_fd; fd_num < keep_fd; ++fd_num) { - while (close(fd_num) < 0 && errno == EINTR); + close(fd_num); } start_fd = keep_fd + 1; } if (start_fd <= end_fd) { for (fd_num = start_fd; fd_num < end_fd; ++fd_num) { - while (close(fd_num) < 0 && errno == EINTR); + close(fd_num); } } } @@ -274,11 +274,11 @@ _close_open_fds_safe(int start_fd, PyObject* py_fds_to_keep) continue; /* Not a number. */ if (fd != fd_dir_fd && fd >= start_fd && !_is_fd_in_sorted_fd_sequence(fd, py_fds_to_keep)) { - while (close(fd) < 0 && errno == EINTR); + close(fd); } } } - while (close(fd_dir_fd) < 0 && errno == EINTR); + close(fd_dir_fd); } } @@ -312,7 +312,7 @@ _close_open_fds_maybe_unsafe(long start_fd, PyObject* py_fds_to_keep) * reuse that fd otherwise we might close opendir's file descriptor in * our loop. This trick assumes that fd's are allocated on a lowest * available basis. */ - while (close(start_fd) < 0 && errno == EINTR); + close(start_fd); ++start_fd; #endif @@ -339,7 +339,7 @@ _close_open_fds_maybe_unsafe(long start_fd, PyObject* py_fds_to_keep) continue; /* Not a number. */ if (fd != fd_used_by_opendir && fd >= start_fd && !_is_fd_in_sorted_fd_sequence(fd, py_fds_to_keep)) { - while (close(fd) < 0 && errno == EINTR); + close(fd); } errno = 0; } |