diff options
Diffstat (limited to 'shell')
| -rw-r--r-- | shell/ash.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/shell/ash.c b/shell/ash.c index 90fb00fbd..c5ad96909 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
| @@ -6746,6 +6746,14 @@ varvalue(char *name, int varflags, int flags, struct strlist *var_str_list) | |||
| 6746 | len = strlen(p); | 6746 | len = strlen(p); |
| 6747 | if (!(subtype == VSPLUS || subtype == VSLENGTH)) | 6747 | if (!(subtype == VSPLUS || subtype == VSLENGTH)) |
| 6748 | memtodest(p, len, syntax, quotes); | 6748 | memtodest(p, len, syntax, quotes); |
| 6749 | #if ENABLE_UNICODE_SUPPORT | ||
| 6750 | if (subtype == VSLENGTH && len > 0) { | ||
| 6751 | reinit_unicode_for_ash(); | ||
| 6752 | if (unicode_status == UNICODE_ON) { | ||
| 6753 | len = unicode_strlen(p); | ||
| 6754 | } | ||
| 6755 | } | ||
| 6756 | #endif | ||
| 6749 | return len; | 6757 | return len; |
| 6750 | } | 6758 | } |
| 6751 | 6759 | ||
| @@ -6829,15 +6837,7 @@ evalvar(char *p, int flags, struct strlist *var_str_list) | |||
| 6829 | varunset(p, var, 0, 0); | 6837 | varunset(p, var, 0, 0); |
| 6830 | 6838 | ||
| 6831 | if (subtype == VSLENGTH) { | 6839 | if (subtype == VSLENGTH) { |
| 6832 | ssize_t n = varlen; | 6840 | cvtnum(varlen > 0 ? varlen : 0); |
| 6833 | if (n > 0) { | ||
| 6834 | reinit_unicode_for_ash(); | ||
| 6835 | if (unicode_status == UNICODE_ON) { | ||
| 6836 | const char *val = lookupvar(var); | ||
| 6837 | n = unicode_strlen(val); | ||
| 6838 | } | ||
| 6839 | } | ||
| 6840 | cvtnum(n > 0 ? n : 0); | ||
| 6841 | goto record; | 6841 | goto record; |
| 6842 | } | 6842 | } |
| 6843 | 6843 | ||
