From 57e4c1a19f9ee5ebc5757a737d8961d9d0108e09 Mon Sep 17 00:00:00 2001 From: tg Date: Sat, 30 Mar 2013 15:39:26 +0000 Subject: [PATCH] =?UTF-8?q?catch=20missing=20variable=20names=20in=20types?= =?UTF-8?q?et,=20to=20avoid=20confusing=20Hugues=20Moretto-Viry=20with=20b?= =?UTF-8?q?ogus=20=E2=80=9Cread-only=E2=80=9D=20messages?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- var.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/var.c b/var.c index 19527e0..3c89435 100644 --- a/var.c +++ b/var.c @@ -27,7 +27,7 @@ #include #endif -__RCSID("$MirOS: src/bin/mksh/var.c,v 1.166 2013/02/18 22:24:52 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/var.c,v 1.167 2013/03/30 15:39:26 tg Exp $"); /*- * Variables @@ -708,6 +708,10 @@ typeset(const char *var, uint32_t set, uint32_t clr, int field, int base) /* check for valid variable name, search for value */ val = skip_varname(var, false); + if (val == var) { + /* no variable name given */ + return (NULL); + } if (*val == '[') { if (set_refflag != SRF_NOP) errorf("%s: %s", var, @@ -742,7 +746,6 @@ typeset(const char *var, uint32_t set, uint32_t clr, int field, int base) * must have a = when setting a variable by importing * the original environment, otherwise be empty; we * also end up here when a variable name was invalid - * or none given */ return (NULL); } else {