diff options
author | Denis Vlasenko | 2008-06-10 18:27:50 +0000 |
---|---|---|
committer | Denis Vlasenko | 2008-06-10 18:27:50 +0000 |
commit | 2e76c3f9016f674dad7a38ec7ba5b068d233f189 (patch) | |
tree | 6c9f4604f34ea3b0ca2eceac08d665eca467bfde /shell/hush.c | |
parent | 895bea23032221bcc158f447f81abacd046f87b1 (diff) | |
download | busybox-2e76c3f9016f674dad7a38ec7ba5b068d233f189.zip busybox-2e76c3f9016f674dad7a38ec7ba5b068d233f189.tar.gz |
hush: fix yet another fallout
hush: move fixed testsuites out of hush-bugs/*
Diffstat (limited to 'shell/hush.c')
-rw-r--r-- | shell/hush.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/shell/hush.c b/shell/hush.c index 603e19f..82bad66 100644 --- a/shell/hush.c +++ b/shell/hush.c @@ -2691,19 +2691,18 @@ static int expand_vars_to_list(o_string *output, int n, char *arg, char or_mask) arg = ++p; } /* end of "while (SPECIAL_VAR_SYMBOL is found) ..." */ - { - int len = strlen(arg); - if (len) { - o_debug_list("expand_vars_to_list[a]", output, n); - o_addstr(output, arg, len + 1); - o_debug_list("expand_vars_to_list[b]", output, n); - } else if (output->length == o_get_last_ptr(output, n)) { /* expansion is empty */ - if (!(ored_ch & 0x80)) { /* all vars were not quoted... */ - n--; - /* allow to reuse list[n] later without re-growth */ - output->has_empty_slot = 1; - } - } + if (arg[0]) { + o_debug_list("expand_vars_to_list[a]", output, n); + o_addstr(output, arg, strlen(arg) + 1); + o_debug_list("expand_vars_to_list[b]", output, n); + } else if (output->length == o_get_last_ptr(output, n) /* expansion is empty */ + && !(ored_ch & 0x80) /* and all vars were not quoted. */ + ) { + n--; + /* allow to reuse list[n] later without re-growth */ + output->has_empty_slot = 1; + } else { + o_addchr(output, '\0'); } return n; } |