search for: openredirect

Displaying 5 results from an estimated 5 matches for "openredirect".

2019 Jan 25
0
[klibc:update-dash] redir: Fix typo in noclobber code
...ana.org.au> Signed-off-by: Ben Hutchings <ben at decadent.org.uk> --- usr/dash/redir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr/dash/redir.c b/usr/dash/redir.c index f96a76bc..71b0f774 100644 --- a/usr/dash/redir.c +++ b/usr/dash/redir.c @@ -192,7 +192,7 @@ openredirect(union node *redir) } else if (!S_ISREG(sb.st_mode)) { if ((f = open64(fname, O_WRONLY, 0666)) < 0) goto ecreate; - if (fstat64(f, &sb) < 0 && S_ISREG(sb.st_mode)) { + if (!fstat64(f, &sb) && S_ISREG(sb.st_mode)) { close(f); errno = EEXI...
2020 Mar 28
0
[klibc:update-dash] dash: redir: Fix typo in noclobber code
...ana.org.au> Signed-off-by: Ben Hutchings <ben at decadent.org.uk> --- usr/dash/redir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr/dash/redir.c b/usr/dash/redir.c index f96a76bc..71b0f774 100644 --- a/usr/dash/redir.c +++ b/usr/dash/redir.c @@ -192,7 +192,7 @@ openredirect(union node *redir) } else if (!S_ISREG(sb.st_mode)) { if ((f = open64(fname, O_WRONLY, 0666)) < 0) goto ecreate; - if (fstat64(f, &sb) < 0 && S_ISREG(sb.st_mode)) { + if (!fstat64(f, &sb) && S_ISREG(sb.st_mode)) { close(f); errno = EEXI...
2020 Mar 28
0
[klibc:update-dash] dash: redir: Handle nested exec within REALLY_CLOSED redirection
...#define EMPTY -2 /* marks an unused slot in redirtab */ #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 &l...
2007 Aug 23
0
[git patch] klibc dash 0.5.4 update
...redirlist; @@ -132,12 +132,11 @@ redirect(union node *redir, int flags) } n = redir; do { - fd = n->nfile.fd; - if ((n->nfile.type == NTOFD || n->nfile.type == NFROMFD) && - n->ndup.dupfd == fd) - continue; /* redirect from/to same file descriptor */ - newfd = openredirect(n); + if (newfd < -1) + continue; + + fd = n->nfile.fd; if (sv) { p = &sv->renamed[fd]; @@ -174,7 +173,7 @@ redirect(union node *redir, int flags) if (memory[2]) out2 = &memout; #endif - if (flags & REDIR_SAVEFD2 && sv && sv->renamed[2] &gt...
2020 Mar 28
0
[klibc:update-dash] dash: parser: Fix old-style command substitution here-document crash
...GV on unknown address 0x000000000010 (pc 0x0000005768ed bp 0x7ffc00273df0 sp 0x7ffc00273c60 T0) > ==39623==The signal is caused by a READ memory access. > ==39623==Hint: address points to the zero page. > #0 0x5768ec in openhere /home/jfe/dash/src/redir.c:305:29 > #1 0x574d92 in openredirect /home/jfe/dash/src/redir.c:230:7 > #2 0x5737fe in redirect /home/jfe/dash/src/redir.c:121:11 > #3 0x576017 in redirectsafe /home/jfe/dash/src/redir.c:424:3 > #4 0x522326 in evalcommand /home/jfe/dash/src/eval.c:828:11 > #5 0x520010 in evaltree /home/jfe/dash/src/eval.c:2...