search for: update_closed_redirs

Displaying 1 result from an estimated 1 matches for "update_closed_redirs".

2020 Mar 28
0
[klibc:update-dash] dash: redir: Handle nested exec within REALLY_CLOSED redirection
...rrently closed file descriptors. */ +static unsigned closed_redirs; + STATIC int openredirect(union node *); #ifdef notyet STATIC void dupredirect(union node *, int, char[10]); @@ -86,6 +88,20 @@ STATIC void dupredirect(union node *, int); STATIC int openhere(union node *); +static unsigned update_closed_redirs(int fd, int nfd) +{ + unsigned val = closed_redirs; + unsigned bit = 1 << fd; + + if (nfd >= 0) + closed_redirs &= ~bit; + else + closed_redirs |= bit; + + return val & bit; +} + + /* * Process a list of redirection commands. If the REDIR_PUSH flag is set, * old file descri...