aboutsummaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
Diffstat (limited to 'shell')
-rw-r--r--shell/ash.c6
-rw-r--r--shell/hush.c2
2 files changed, 6 insertions, 2 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 34f70ecfc..e018e877b 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -5059,7 +5059,7 @@ static int is_hidden_fd(struct redirtab *rp, int fd)
5059 return 0; 5059 return 0;
5060 pf = g_parsefile; 5060 pf = g_parsefile;
5061 while (pf) { 5061 while (pf) {
5062 if (fd == pf->fd) { 5062 if (pf->fd > 0 && fd == pf->fd) {
5063 return 1; 5063 return 1;
5064 } 5064 }
5065 pf = pf->prev; 5065 pf = pf->prev;
@@ -5424,7 +5424,11 @@ rmescapes(char *str, int flag)
5424 size_t fulllen = len + strlen(p) + 1; 5424 size_t fulllen = len + strlen(p) + 1;
5425 5425
5426 if (flag & RMESCAPE_GROW) { 5426 if (flag & RMESCAPE_GROW) {
5427 int strloc = str - (char *)stackblock();
5427 r = makestrspace(fulllen, expdest); 5428 r = makestrspace(fulllen, expdest);
5429 /* p and str may be invalidated by makestrspace */
5430 str = (char *)stackblock() + strloc;
5431 p = str + len;
5428 } else if (flag & RMESCAPE_HEAP) { 5432 } else if (flag & RMESCAPE_HEAP) {
5429 r = ckmalloc(fulllen); 5433 r = ckmalloc(fulllen);
5430 } else { 5434 } else {
diff --git a/shell/hush.c b/shell/hush.c
index 2aeb8e440..78f0f7940 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -6944,7 +6944,7 @@ int hush_main(int argc, char **argv)
6944 /* -c 'script' (no params): prevent empty $0 */ 6944 /* -c 'script' (no params): prevent empty $0 */
6945 G.global_argv--; /* points to argv[i] of 'script' */ 6945 G.global_argv--; /* points to argv[i] of 'script' */
6946 G.global_argv[0] = argv[0]; 6946 G.global_argv[0] = argv[0];
6947 G.global_argc--; 6947 G.global_argc++;
6948 } /* else -c 'script' ARG0 [ARG1...]: $0 is ARG0 */ 6948 } /* else -c 'script' ARG0 [ARG1...]: $0 is ARG0 */
6949 init_sigmasks(); 6949 init_sigmasks();
6950 parse_and_run_string(optarg); 6950 parse_and_run_string(optarg);