[git commit] hush: forgot to emit error on (failing) second "readonly VAR=VAL"

Denys Vlasenko vda.linux at googlemail.com
Mon Jul 17 19:31:17 UTC 2017


commit: https://git.busybox.net/busybox/commit/?id=6b48e1f1212300464c17c8317f5faddf6b414a4c
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 shell/hush.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/shell/hush.c b/shell/hush.c
index 2125e75..1961c98 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -2074,6 +2074,7 @@ static int set_local_var(char *str,
 	char *eq_sign;
 	int name_len;
 
+	//bb_error_msg("set_local_var('%s',%d,%d,%d)", str, flg_export, local_lvl, flg_read_only);
 	eq_sign = strchr(str, '=');
 	if (!eq_sign) { /* not expected to ever happen? */
 		free(str);
@@ -2090,8 +2091,7 @@ static int set_local_var(char *str,
 
 		/* We found an existing var with this name */
 		if (cur->flg_read_only) {
-			if (!flg_read_only)
-				bb_error_msg("%s: readonly variable", str);
+			bb_error_msg("%s: readonly variable", str);
 			free(str);
 			return -1;
 		}
@@ -9459,7 +9459,6 @@ static int FAST_FUNC builtin_readonly(char **argv)
 }
 #endif
 
-
 #if ENABLE_HUSH_UNSET
 /* http://www.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#unset */
 static int FAST_FUNC builtin_unset(char **argv)


More information about the busybox-cvs mailing list