Displaying 2 results from an estimated 2 matches for "dupredirect".
2020 Mar 28
0
[klibc:update-dash] dash: redir: Handle nested exec within REALLY_CLOSED redirection
.../
#define CLOSED -1 /* fd opened for redir needs to be closed */
@@ -77,6 +76,9 @@ struct redirtab {
MKINIT struct redirtab *redirlist;
+/* Bit map of currently 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 &=...
2007 Aug 23
0
[git patch] klibc dash 0.5.4 update
...}
+
+ if (i == newfd)
+ /* Can only happen if i == newfd == CLOSED */
+ i = REALLY_CLOSED;
+
+ *p = i;
+ }
+
if (fd == newfd)
continue;
- if (sv && *(p = &sv->renamed[fd]) == EMPTY) {
- int i = savefd(fd);
- if (i >= 0)
- *p = i;
- }
#ifdef notyet
dupredirect(n, newfd, memory);
#else
@@ -204,7 +222,7 @@ openredirect(union node *redir)
/* Fall through to eliminate warning. */
case NTOFD:
case NFROMFD:
- f = -1;
+ f = redir->ndup.dupfd;
break;
case NHERE:
case NXHERE:
@@ -239,9 +257,10 @@ dupredirect(redir, f)
memory[fd] = 0;
#endif...