Displaying 20 results from an estimated 36 matches for "intoff".
2019 Jan 25
0
[klibc:update-dash] input: Move all input state into parsefile
...tc - 1;
- if (parsenleft < 0)
+ parsefile->nleft = q - parsefile->nextc - 1;
+ if (parsefile->nleft < 0)
goto again;
break;
}
}
- parselleft = more;
+ parsefile->lleft = more;
savec = *q;
*q = '\0';
@@ -298,13 +272,13 @@ again:
HistEvent he;
INTOFF;
history(hist, &he, whichprompt == 1? H_ENTER : H_APPEND,
- parsenextc);
+ parsefile->nextc);
INTON;
}
#endif
if (vflag) {
- out2str(parsenextc);
+ out2str(parsefile->nextc);
#ifdef FLUSHERR
flushout(out2);
#endif
@@ -312,7 +286,7 @@ again:
*q = savec;
- r...
2020 Mar 28
0
[klibc:update-dash] dash: input: Move all input state into parsefile
...tc - 1;
- if (parsenleft < 0)
+ parsefile->nleft = q - parsefile->nextc - 1;
+ if (parsefile->nleft < 0)
goto again;
break;
}
}
- parselleft = more;
+ parsefile->lleft = more;
savec = *q;
*q = '\0';
@@ -298,13 +272,13 @@ again:
HistEvent he;
INTOFF;
history(hist, &he, whichprompt == 1? H_ENTER : H_APPEND,
- parsenextc);
+ parsefile->nextc);
INTON;
}
#endif
if (vflag) {
- out2str(parsenextc);
+ out2str(parsefile->nextc);
#ifdef FLUSHERR
flushout(out2);
#endif
@@ -312,7 +286,7 @@ again:
*q = savec;
- r...
2020 Mar 28
0
[klibc:update-dash] dash: eval: Add vfork support
...7 @@
#include <stdio.h>
#include <string.h>
+#include "jobs.h"
#include "shell.h"
#include "main.h"
#include "options.h"
@@ -81,6 +82,10 @@ exraise(int e)
if (handler == NULL)
abort();
#endif
+
+ if (vforked)
+ _exit(exitstatus);
+
INTOFF;
exception = e;
diff --git a/usr/dash/eval.c b/usr/dash/eval.c
index 77a8bded..7bb636e1 100644
--- a/usr/dash/eval.c
+++ b/usr/dash/eval.c
@@ -892,10 +892,8 @@ bail:
/* Fork off a child process if necessary. */
if (!(flags & EV_EXIT) || have_traps()) {
INTOFF;
- jp = makejob(cmd...
2019 Jan 25
0
[klibc:update-dash] [BUILTIN] Do not allow break to break across function calls
...rgv, int flags)
shellparam.malloc = 0;
func->count++;
funcline = func->n.ndefun.linno;
+ loopnest = 0;
INTON;
shellparam.nparam = argc - 1;
shellparam.p = argv + 1;
@@ -950,6 +953,7 @@ evalfun(struct funcnode *func, int argc, char **argv, int flags)
poplocalvars(0);
funcdone:
INTOFF;
+ loopnest = saveloopnest;
funcline = savefuncline;
freefunc(func);
freeparam(&shellparam);
2019 Jan 25
0
[klibc:update-dash] [OUTPUT] Add ifdefs around MEM_OUT handling in outmem
...def notyet
if (dest->fd == MEM_OUT && len > bufsize) {
bufsize = len;
}
+#endif
offset = 0;
+#ifdef notyet
goto alloc;
} else if (dest->fd == MEM_OUT) {
offset = bufsize;
@@ -169,6 +172,7 @@ buffered:
if (bufsize < offset)
goto err;
alloc:
+#endif
INTOFF;
dest->buf = ckrealloc(dest->buf, bufsize);
dest->bufsize = bufsize;
@@ -184,7 +188,9 @@ alloc:
goto buffered;
if ((xwrite(dest->fd, p, len))) {
+#ifdef notyet
err:
+#endif
dest->flags |= OUTPUT_ERR;
}
#endif
2020 Mar 28
0
[klibc:update-dash] dash: [BUILTIN] Do not allow break to break across function calls
...rgv, int flags)
shellparam.malloc = 0;
func->count++;
funcline = func->n.ndefun.linno;
+ loopnest = 0;
INTON;
shellparam.nparam = argc - 1;
shellparam.p = argv + 1;
@@ -950,6 +953,7 @@ evalfun(struct funcnode *func, int argc, char **argv, int flags)
poplocalvars(0);
funcdone:
INTOFF;
+ loopnest = saveloopnest;
funcline = savefuncline;
freefunc(func);
freeparam(&shellparam);
2020 Mar 28
0
[klibc:update-dash] dash: [OUTPUT] Add ifdefs around MEM_OUT handling in outmem
...def notyet
if (dest->fd == MEM_OUT && len > bufsize) {
bufsize = len;
}
+#endif
offset = 0;
+#ifdef notyet
goto alloc;
} else if (dest->fd == MEM_OUT) {
offset = bufsize;
@@ -169,6 +172,7 @@ buffered:
if (bufsize < offset)
goto err;
alloc:
+#endif
INTOFF;
dest->buf = ckrealloc(dest->buf, bufsize);
dest->bufsize = bufsize;
@@ -184,7 +188,9 @@ alloc:
goto buffered;
if ((xwrite(dest->fd, p, len))) {
+#ifdef notyet
err:
+#endif
dest->flags |= OUTPUT_ERR;
}
#endif
2011 Nov 30
1
[PATCH] [MEMALLOC] remove unused variable
...dash/memalloc.c
+++ b/usr/dash/memalloc.c
@@ -213,13 +213,11 @@ growstackblock(void)
newlen += 128;
if (stacknxt == stackp->space && stackp != &stackbase) {
- struct stack_block *oldstackp;
struct stack_block *sp;
struct stack_block *prevstackp;
size_t grosslen;
INTOFF;
- oldstackp = stackp;
sp = stackp;
prevstackp = sp->prev;
grosslen = newlen + sizeof(struct stack_block) - MINSIZE;
--
1.7.3.1
2012 Jul 02
0
[klibc:master] [MEMALLOC] Avoid gcc warning: variable ' oldstackp' set but not used
...ewlen < stacknleft)
sh_error("Out of space");
if (newlen < 128)
newlen += 128;
if (stacknxt == stackp->space && stackp != &stackbase) {
- struct stack_block *oldstackp;
struct stack_block *sp;
struct stack_block *prevstackp;
size_t grosslen;
INTOFF;
- oldstackp = stackp;
sp = stackp;
prevstackp = sp->prev;
grosslen = newlen + sizeof(struct stack_block) - MINSIZE;
2019 Jan 25
0
[klibc:update-dash] jobs - Do not block when waiting on SIGCHLD
...-------
usr/dash/jobs.c | 13 ++++++++++---
2 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/usr/dash/eval.c b/usr/dash/eval.c
index 2f662e3e..56661880 100644
--- a/usr/dash/eval.c
+++ b/usr/dash/eval.c
@@ -859,10 +859,8 @@ bail:
if (!(flags & EV_EXIT) || have_traps()) {
INTOFF;
jp = makejob(cmd, 1);
- if (forkshell(jp, cmd, FORK_FG) != 0) {
- INTON;
+ if (forkshell(jp, cmd, FORK_FG) != 0)
break;
- }
FORCEINTON;
}
listsetvar(varlist.list, VEXPORT|VSTACK);
@@ -875,11 +873,8 @@ bail:
if (execcmd && argc > 1)
listsetvar(varlist...
2020 Mar 28
0
[klibc:update-dash] dash: jobs - Do not block when waiting on SIGCHLD
...-------
usr/dash/jobs.c | 13 ++++++++++---
2 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/usr/dash/eval.c b/usr/dash/eval.c
index 722066e5..13e690e7 100644
--- a/usr/dash/eval.c
+++ b/usr/dash/eval.c
@@ -859,10 +859,8 @@ bail:
if (!(flags & EV_EXIT) || have_traps()) {
INTOFF;
jp = makejob(cmd, 1);
- if (forkshell(jp, cmd, FORK_FG) != 0) {
- INTON;
+ if (forkshell(jp, cmd, FORK_FG) != 0)
break;
- }
FORCEINTON;
}
listsetvar(varlist.list, VEXPORT|VSTACK);
@@ -875,11 +873,8 @@ bail:
if (execcmd && argc > 1)
listsetvar(varlist...
2019 Jan 25
0
[klibc:update-dash] eval: Reap zombies after built-in commands and functions
...8 deletions(-)
diff --git a/usr/dash/eval.c b/usr/dash/eval.c
index 6ba64b12..811c28a4 100644
--- a/usr/dash/eval.c
+++ b/usr/dash/eval.c
@@ -848,6 +848,8 @@ bail:
goto out;
}
+ jp = NULL;
+
/* Execute the command. */
switch (cmdentry.cmdtype) {
default:
@@ -856,7 +858,6 @@ bail:
INTOFF;
jp = makejob(cmd, 1);
if (forkshell(jp, cmd, FORK_FG) != 0) {
- status = waitforjob(jp);
INTON;
break;
}
@@ -875,22 +876,22 @@ bail:
if (evalbltin(cmdentry.u.cmd, argc, argv, flags)) {
if (exception == EXERROR && spclbltin <= 0) {
FORCEINTON;
- go...
2020 Mar 28
0
[klibc:update-dash] dash: eval: Reap zombies after built-in commands and functions
...8 deletions(-)
diff --git a/usr/dash/eval.c b/usr/dash/eval.c
index a679ba31..26055493 100644
--- a/usr/dash/eval.c
+++ b/usr/dash/eval.c
@@ -848,6 +848,8 @@ bail:
goto out;
}
+ jp = NULL;
+
/* Execute the command. */
switch (cmdentry.cmdtype) {
default:
@@ -856,7 +858,6 @@ bail:
INTOFF;
jp = makejob(cmd, 1);
if (forkshell(jp, cmd, FORK_FG) != 0) {
- status = waitforjob(jp);
INTON;
break;
}
@@ -875,22 +876,22 @@ bail:
if (evalbltin(cmdentry.u.cmd, argc, argv, flags)) {
if (exception == EXERROR && spclbltin <= 0) {
FORCEINTON;
- go...
2019 Jan 25
0
[klibc:update-dash] eval: Variable assignments on functions are no longer persistent
...goto raise;
break;
@@ -971,9 +970,7 @@ evalfun(struct funcnode *func, int argc, char **argv, int flags)
shellparam.p = argv + 1;
shellparam.optind = 1;
shellparam.optoff = -1;
- pushlocalvars();
evaltree(func->n.ndefun.body, flags & EV_TESTED);
- poplocalvars(0);
funcdone:
INTOFF;
loopnest = saveloopnest;
2020 Mar 28
0
[klibc:update-dash] dash: eval: Variable assignments on functions are no longer persistent
...goto raise;
break;
@@ -971,9 +970,7 @@ evalfun(struct funcnode *func, int argc, char **argv, int flags)
shellparam.p = argv + 1;
shellparam.optind = 1;
shellparam.optoff = -1;
- pushlocalvars();
evaltree(func->n.ndefun.body, flags & EV_TESTED);
- poplocalvars(0);
funcdone:
INTOFF;
loopnest = saveloopnest;
2020 Mar 28
0
[klibc:update-dash] dash: eval: Always set localvar_stop
...@@ -562,18 +562,24 @@ poplocalvars(int keep)
/*
* Create a new localvar environment.
*/
-struct localvar_list *pushlocalvars(void)
+struct localvar_list *pushlocalvars(int push)
{
struct localvar_list *ll;
+ struct localvar_list *top;
+
+ top = localvar_stack;
+ if (!push)
+ goto out;
INTOFF;
ll = ckmalloc(sizeof(*ll));
ll->lv = NULL;
- ll->next = localvar_stack;
+ ll->next = top;
localvar_stack = ll;
INTON;
- return ll->next;
+out:
+ return top;
}
diff --git a/usr/dash/var.h b/usr/dash/var.h
index 8759be46..e545e02c 100644
--- a/usr/dash/var.h
+++ b/usr/dash...
2020 Mar 28
0
[klibc:update-dash] dash: redir: Handle nested exec within REALLY_CLOSED redirection
...i = CLOSED;
- if (fd != newfd) {
+ if (fd != newfd && !closed) {
i = savefd(fd, fd);
fd = -1;
}
}
- if (i == newfd)
- /* Can only happen if i == newfd == CLOSED */
- i = REALLY_CLOSED;
-
*p = i;
}
@@ -346,14 +362,18 @@ popredir(int drop)
INTOFF;
rp = redirlist;
for (i = 0 ; i < 10 ; i++) {
+ int closed;
+
+ if (rp->renamed[i] == EMPTY)
+ continue;
+
+ closed = drop ? 1 : update_closed_redirs(i, rp->renamed[i]);
+
switch (rp->renamed[i]) {
case CLOSED:
- if (!drop)
+ if (!closed)
close(i);
break;
-...
2019 Jan 25
0
[klibc:update-dash] expand: Fix buffer overflow in expandmeta
...r;
+STATIC unsigned expdir_max;
STATIC void
@@ -1260,6 +1261,7 @@ expandmeta(struct strlist *str, int flag)
struct strlist **savelastp;
struct strlist *sp;
char *p;
+ unsigned len;
if (fflag)
goto nometa;
@@ -1269,12 +1271,11 @@ expandmeta(struct strlist *str, int flag)
INTOFF;
p = preglob(str->text, RMESCAPE_ALLOC | RMESCAPE_HEAP);
- {
- int i = strlen(str->text);
- expdir = ckmalloc(i < 2048 ? 2048 : i); /* XXX */
- }
+ len = strlen(p);
+ expdir_max = len + PATH_MAX;
+ expdir = ckmalloc(expdir_max);
- expmeta(expdir, p);
+ expmeta(p, len, 0);...
2020 Mar 28
0
[klibc:update-dash] dash: expand: Fix buffer overflow in expandmeta
...r;
+STATIC unsigned expdir_max;
STATIC void
@@ -1260,6 +1261,7 @@ expandmeta(struct strlist *str, int flag)
struct strlist **savelastp;
struct strlist *sp;
char *p;
+ unsigned len;
if (fflag)
goto nometa;
@@ -1269,12 +1271,11 @@ expandmeta(struct strlist *str, int flag)
INTOFF;
p = preglob(str->text, RMESCAPE_ALLOC | RMESCAPE_HEAP);
- {
- int i = strlen(str->text);
- expdir = ckmalloc(i < 2048 ? 2048 : i); /* XXX */
- }
+ len = strlen(p);
+ expdir_max = len + PATH_MAX;
+ expdir = ckmalloc(expdir_max);
- expmeta(expdir, p);
+ expmeta(p, len, 0);...
2020 Mar 28
0
[klibc:update-dash] dash: expand: Merge syntax/quotes in memtodest with flags
...trtodest(home, SQSYNTAX, quotes);
+ strtodest(home, flag | EXP_QUOTED);
return (p);
lose:
*p = c;
@@ -513,7 +510,6 @@ expbackq(union node *cmd, int flag)
char *p;
char *dest;
int startloc;
- char const *syntax = flag & EXP_QUOTED ? DQSYNTAX : BASESYNTAX;
struct stackmark smark;
INTOFF;
@@ -527,7 +523,7 @@ expbackq(union node *cmd, int flag)
if (i == 0)
goto read;
for (;;) {
- memtodest(p, i, syntax, flag & QUOTES_ESC);
+ memtodest(p, i, flag);
read:
if (in.fd < 0)
break;
@@ -835,8 +831,9 @@ end:
* Put a string on the stack.
*/
-STATIC void
-memtodes...