about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2001-06-14 09:49:01 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2001-06-14 09:49:01 +0000
commitd247b7f14664f234802bdc2c205ad510e4e400d4 (patch)
treeb93c30ab897f2bde4ac0f799e65ffab870cec2b9 /Src
parenta5a5aa4e3e43d3e83a5aa8770f9170ea6ace6e32 (diff)
downloadzsh-d247b7f14664f234802bdc2c205ad510e4e400d4.tar.gz
zsh-d247b7f14664f234802bdc2c205ad510e4e400d4.tar.xz
zsh-d247b7f14664f234802bdc2c205ad510e4e400d4.zip
$* and $@ are special
Diffstat (limited to 'Src')
-rw-r--r--Src/builtin.c9
-rw-r--r--Src/params.c4
2 files changed, 10 insertions, 3 deletions
diff --git a/Src/builtin.c b/Src/builtin.c
index ad340afc8..110a264f2 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -1628,7 +1628,14 @@ typeset_single(char *cname, char *pname, Param pm, int func,
 	if ((tc = chflags && chflags != (PM_EFLOAT|PM_FFLOAT)))
 	    usepm = 0;
     }
-    if (tc){
+
+    /*
+     * Extra checks if converting the type of a parameter, or if
+     * trying to remove readonlyness.  It's dangerous doing either
+     * with a special or a parameter which isn't loaded yet (which
+     * may be special when it is loaded; we can't tell yet).
+     */
+    if (tc || ((usepm || newspecial) && (off & pm->flags & PM_READONLY))) {
 	if (pm->flags & PM_SPECIAL) {
 	    zerrnam(cname, "%s: can't change type of a special parameter",
 		    pname, 0);
diff --git a/Src/params.c b/Src/params.c
index f4575b56e..7eec34bf4 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -216,8 +216,8 @@ IPDEF8("MODULE_PATH", &module_path, "module_path", PM_DONTIMPORT|PM_RESTRICTED),
 
 #define IPDEF9F(A,B,C,D) {NULL,A,D|PM_ARRAY|PM_SPECIAL|PM_DONTIMPORT,BR((void *)B),SFN(arrvarsetfn),GFN(arrvargetfn),stdunsetfn,0,NULL,C,NULL,0}
 #define IPDEF9(A,B,C) IPDEF9F(A,B,C,0)
-IPDEF9("*", &pparams, NULL),
-IPDEF9("@", &pparams, NULL),
+IPDEF9F("*", &pparams, NULL, PM_ARRAY|PM_SPECIAL|PM_DONTIMPORT|PM_READONLY),
+IPDEF9F("@", &pparams, NULL, PM_ARRAY|PM_SPECIAL|PM_DONTIMPORT|PM_READONLY),
 {NULL, NULL},
 #define IPDEF10(A,B,C) {NULL,A,PM_ARRAY|PM_SPECIAL,BR(NULL),SFN(C),GFN(B),stdunsetfn,10,NULL,NULL,NULL,0}