summaryrefslogtreecommitdiffhomepage
path: root/shell/hush.c
diff options
context:
space:
mode:
authorDenys Vlasenko <dvlasenk@redhat.com>2010-09-13 00:34:26 +0200
committerDenys Vlasenko <dvlasenk@redhat.com>2010-09-13 00:34:26 +0200
commitb771c654cab511b172484479cafd006d52588103 (patch)
tree54a5cd2fb09061217441afb00053a6e9c2e00284 /shell/hush.c
parent99862cbfad9c36b4f8f4378c3a7a9f077c239f20 (diff)
shell: shrink arith code; and prepare for returning text error codes
function old new delta arith 701 680 -21 Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'shell/hush.c')
-rw-r--r--shell/hush.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/shell/hush.c b/shell/hush.c
index 752efd0c8..ef0c454ec 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -4728,9 +4728,9 @@ static NOINLINE const char *expand_one_var(char **to_be_freed_pp, char *arg, cha
if (beg < 0) /* bash compat */
beg = 0;
debug_printf_varexp("from val:'%s'\n", val);
- if (len == 0 || !val || beg >= strlen(val))
- val = "";
- else {
+ if (len == 0 || !val || beg >= strlen(val)) {
+ val = NULL;
+ } else {
/* Paranoia. What if user entered 9999999999999
* which fits in arith_t but not int? */
if (len >= INT_MAX)
@@ -4742,7 +4742,7 @@ static NOINLINE const char *expand_one_var(char **to_be_freed_pp, char *arg, cha
#endif
{
die_if_script("malformed ${%s:...}", var);
- val = "";
+ val = NULL;
}
} else { /* one of "-=+?" */
/* Standard-mandated substitution ops: