diff options
Diffstat (limited to 'shell/hush.c')
-rw-r--r-- | shell/hush.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/shell/hush.c b/shell/hush.c index 55e581e16..f6da826d3 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -2287,7 +2287,18 @@ static struct variable *set_vars_and_save_old(char **strings) | |||
2287 | if (var_pp) { | 2287 | if (var_pp) { |
2288 | var_p = *var_pp; | 2288 | var_p = *var_pp; |
2289 | if (var_p->flg_read_only) { | 2289 | if (var_p->flg_read_only) { |
2290 | char **p; | ||
2290 | bb_error_msg("%s: readonly variable", *s); | 2291 | bb_error_msg("%s: readonly variable", *s); |
2292 | /* | ||
2293 | * "VAR=V BLTIN" unsets VARs after BLTIN completes. | ||
2294 | * If VAR is readonly, leaving it in the list | ||
2295 | * after asssignment error (msg above) | ||
2296 | * causes doubled error message later, on unset. | ||
2297 | */ | ||
2298 | debug_printf_env("removing/freeing '%s' element\n", *s); | ||
2299 | free(*s); | ||
2300 | p = s; | ||
2301 | do { *p = p[1]; p++; } while (*p); | ||
2291 | goto next; | 2302 | goto next; |
2292 | } | 2303 | } |
2293 | /* Remove variable from global linked list */ | 2304 | /* Remove variable from global linked list */ |