mirror of
https://github.com/sudo-project/sudo.git
synced 2025-08-31 06:15:37 +00:00
When restoring fds traverse list from high -> low, not low -> high
to avoid implicitly closing an fd we want to relocate.
This commit is contained in:
@@ -166,7 +166,7 @@ closefrom_except(int startfd, struct preserved_fd_list *pfds)
|
||||
closefrom(startfd);
|
||||
|
||||
/* Restore preserved fds and set flags. */
|
||||
TAILQ_FOREACH(pfd, pfds, entries) {
|
||||
TAILQ_FOREACH_REVERSE(pfd, pfds, preserved_fd_list, entries) {
|
||||
if (pfd->lowfd != pfd->highfd) {
|
||||
if (dup2(pfd->lowfd, pfd->highfd) == -1) {
|
||||
sudo_debug_printf(SUDO_DEBUG_ERROR|SUDO_DEBUG_LINENO,
|
||||
|
Reference in New Issue
Block a user