diff options
author | Ron Yorston <rmy@pobox.com> | 2013-02-07 14:25:54 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2013-02-07 14:25:54 +0000 |
commit | b604585914e032b28bef3e337a978e56a9069cda (patch) | |
tree | b2ee0a3fb38d10397c602d0fe215ea3bbbf334c0 /shell | |
parent | 0eda07c7ff8cf1fc11bc1bda5383f884d7adf031 (diff) | |
parent | ba76b7a40b929878833731f76306b1c977cc8650 (diff) | |
download | busybox-w32-b604585914e032b28bef3e337a978e56a9069cda.tar.gz busybox-w32-b604585914e032b28bef3e337a978e56a9069cda.tar.bz2 busybox-w32-b604585914e032b28bef3e337a978e56a9069cda.zip |
Merge branch 'busybox' into merge
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ash.c | 17 | ||||
-rw-r--r-- | shell/hush.c | 6 | ||||
-rw-r--r-- | shell/math.c | 2 |
3 files changed, 18 insertions, 7 deletions
diff --git a/shell/ash.c b/shell/ash.c index 7a50e73f3..75c01ec14 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -3737,7 +3737,8 @@ set_curjob(struct job *jp, unsigned mode) | |||
3737 | break; | 3737 | break; |
3738 | case CUR_RUNNING: | 3738 | case CUR_RUNNING: |
3739 | /* newly created job or backgrounded job, | 3739 | /* newly created job or backgrounded job, |
3740 | put after all stopped jobs. */ | 3740 | * put after all stopped jobs. |
3741 | */ | ||
3741 | while (1) { | 3742 | while (1) { |
3742 | jp1 = *jpp; | 3743 | jp1 = *jpp; |
3743 | #if JOBS | 3744 | #if JOBS |
@@ -9101,8 +9102,17 @@ expredir(union node *n) | |||
9101 | #if ENABLE_ASH_BASH_COMPAT | 9102 | #if ENABLE_ASH_BASH_COMPAT |
9102 | store_expfname: | 9103 | store_expfname: |
9103 | #endif | 9104 | #endif |
9105 | #if 0 | ||
9106 | // By the design of stack allocator, the loop of this kind: | ||
9107 | // while true; do while true; do break; done </dev/null; done | ||
9108 | // will look like a memory leak: ash plans to free expfname's | ||
9109 | // of "/dev/null" as soon as it finishes running the loop | ||
9110 | // (in this case, never). | ||
9111 | // This "fix" is wrong: | ||
9104 | if (redir->nfile.expfname) | 9112 | if (redir->nfile.expfname) |
9105 | stunalloc(redir->nfile.expfname); | 9113 | stunalloc(redir->nfile.expfname); |
9114 | // It results in corrupted state of stacked allocations. | ||
9115 | #endif | ||
9106 | redir->nfile.expfname = fn.list->text; | 9116 | redir->nfile.expfname = fn.list->text; |
9107 | break; | 9117 | break; |
9108 | case NFROMFD: | 9118 | case NFROMFD: |
@@ -12138,8 +12148,9 @@ parsebackq: { | |||
12138 | INT_ON; | 12148 | INT_ON; |
12139 | if (oldstyle) { | 12149 | if (oldstyle) { |
12140 | /* We must read until the closing backquote, giving special | 12150 | /* We must read until the closing backquote, giving special |
12141 | treatment to some slashes, and then push the string and | 12151 | * treatment to some slashes, and then push the string and |
12142 | reread it as input, interpreting it normally. */ | 12152 | * reread it as input, interpreting it normally. |
12153 | */ | ||
12143 | char *pout; | 12154 | char *pout; |
12144 | size_t psavelen; | 12155 | size_t psavelen; |
12145 | char *pstr; | 12156 | char *pstr; |
diff --git a/shell/hush.c b/shell/hush.c index b9e763cc8..e2dc1e2d0 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -4219,7 +4219,7 @@ static struct pipe *parse_stream(char **pstring, | |||
4219 | /* (this makes bare "&" cmd a no-op. | 4219 | /* (this makes bare "&" cmd a no-op. |
4220 | * bash says: "syntax error near unexpected token '&'") */ | 4220 | * bash says: "syntax error near unexpected token '&'") */ |
4221 | if (pi->num_cmds == 0 | 4221 | if (pi->num_cmds == 0 |
4222 | IF_HAS_KEYWORDS( && pi->res_word == RES_NONE) | 4222 | IF_HAS_KEYWORDS(&& pi->res_word == RES_NONE) |
4223 | ) { | 4223 | ) { |
4224 | free_pipe_list(pi); | 4224 | free_pipe_list(pi); |
4225 | pi = NULL; | 4225 | pi = NULL; |
@@ -4372,7 +4372,7 @@ static struct pipe *parse_stream(char **pstring, | |||
4372 | debug_printf_parse("dest.o_assignment='%s'\n", assignment_flag[dest.o_assignment]); | 4372 | debug_printf_parse("dest.o_assignment='%s'\n", assignment_flag[dest.o_assignment]); |
4373 | /* Do we sit outside of any if's, loops or case's? */ | 4373 | /* Do we sit outside of any if's, loops or case's? */ |
4374 | if (!HAS_KEYWORDS | 4374 | if (!HAS_KEYWORDS |
4375 | IF_HAS_KEYWORDS(|| (ctx.ctx_res_w == RES_NONE && ctx.old_flag == 0)) | 4375 | IF_HAS_KEYWORDS(|| (ctx.ctx_res_w == RES_NONE && ctx.old_flag == 0)) |
4376 | ) { | 4376 | ) { |
4377 | o_free(&dest); | 4377 | o_free(&dest); |
4378 | #if !BB_MMU | 4378 | #if !BB_MMU |
@@ -8281,7 +8281,7 @@ static int FAST_FUNC builtin_exit(char **argv) | |||
8281 | * (if there are _stopped_ jobs, running ones don't count) | 8281 | * (if there are _stopped_ jobs, running ones don't count) |
8282 | * # exit | 8282 | * # exit |
8283 | * exit | 8283 | * exit |
8284 | # EEE (then bash exits) | 8284 | * EEE (then bash exits) |
8285 | * | 8285 | * |
8286 | * TODO: we can use G.exiting = -1 as indicator "last cmd was exit" | 8286 | * TODO: we can use G.exiting = -1 as indicator "last cmd was exit" |
8287 | */ | 8287 | */ |
diff --git a/shell/math.c b/shell/math.c index 760645d0f..15c003965 100644 --- a/shell/math.c +++ b/shell/math.c | |||
@@ -410,7 +410,7 @@ arith_apply(arith_state_t *math_state, operator op, var_or_num_t *numstack, var_ | |||
410 | return "exponent less than 0"; | 410 | return "exponent less than 0"; |
411 | c = 1; | 411 | c = 1; |
412 | while (--right_side_val >= 0) | 412 | while (--right_side_val >= 0) |
413 | c *= rez; | 413 | c *= rez; |
414 | rez = c; | 414 | rez = c; |
415 | } | 415 | } |
416 | else if (right_side_val == 0) | 416 | else if (right_side_val == 0) |