catch missing variable names in typeset, to avoid confusing Hugues Moretto-Viry with bogus “read-only” messages
This commit is contained in:
parent
5c2f250abc
commit
57e4c1a19f
7
var.c
7
var.c
@ -27,7 +27,7 @@
|
|||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
#endif
|
#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
|
* 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 */
|
/* check for valid variable name, search for value */
|
||||||
val = skip_varname(var, false);
|
val = skip_varname(var, false);
|
||||||
|
if (val == var) {
|
||||||
|
/* no variable name given */
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
if (*val == '[') {
|
if (*val == '[') {
|
||||||
if (set_refflag != SRF_NOP)
|
if (set_refflag != SRF_NOP)
|
||||||
errorf("%s: %s", var,
|
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
|
* must have a = when setting a variable by importing
|
||||||
* the original environment, otherwise be empty; we
|
* the original environment, otherwise be empty; we
|
||||||
* also end up here when a variable name was invalid
|
* also end up here when a variable name was invalid
|
||||||
* or none given
|
|
||||||
*/
|
*/
|
||||||
return (NULL);
|
return (NULL);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user