summaryrefslogtreecommitdiff
path: root/bin/ksh/var.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2016-09-08 15:50:51 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2016-09-08 15:50:51 +0000
commite05a2e18893effda4ad10d357b493a808ce999bf (patch)
tree810311039a866488df951c8c6a9d641083002cb1 /bin/ksh/var.c
parent3c5f2cbc38384072a30069201b4b40fea651e3d2 (diff)
Add KSH_IGNORE_RDONLY flag and use it in var.c instead of the 0x4
magic number.
Diffstat (limited to 'bin/ksh/var.c')
-rw-r--r--bin/ksh/var.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/bin/ksh/var.c b/bin/ksh/var.c
index b818df67d89..64bbdd824d2 100644
--- a/bin/ksh/var.c
+++ b/bin/ksh/var.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: var.c,v 1.56 2016/09/08 15:47:16 millert Exp $ */
+/* $OpenBSD: var.c,v 1.57 2016/09/08 15:50:50 millert Exp $ */
#include <sys/stat.h>
@@ -356,8 +356,8 @@ int
setstr(struct tbl *vq, const char *s, int error_ok)
{
const char *fs = NULL;
- int no_ro_check = error_ok & 0x4;
- error_ok &= ~0x4;
+ int no_ro_check = error_ok & KSH_IGNORE_RDONLY;
+ error_ok &= ~KSH_IGNORE_RDONLY;
if ((vq->flag & RDONLY) && !no_ro_check) {
warningf(true, "%s: is read only", vq->name);
if (!error_ok)
@@ -686,7 +686,7 @@ typeset(const char *var, int set, int clr, int field, int base)
}
if (!(t->flag & RDONLY) && (set & RDONLY)) {
/* allow var to be initialized read-only */
- error_ok |= 0x4;
+ error_ok |= KSH_IGNORE_RDONLY;
}
t->flag = (t->flag | set) & ~clr;
/* Don't change base if assignment is to be done,
@@ -722,13 +722,13 @@ typeset(const char *var, int set, int clr, int field, int base)
if (val != NULL) {
if (vp->flag&INTEGER) {
/* do not zero base before assignment */
- setstr(vp, val, KSH_UNWIND_ERROR | 0x4);
+ setstr(vp, val, KSH_UNWIND_ERROR | KSH_IGNORE_RDONLY);
/* Done after assignment to override default */
if (base > 0)
vp->type = base;
} else
/* setstr can't fail (readonly check already done) */
- setstr(vp, val, KSH_RETURN_ERROR | 0x4);
+ setstr(vp, val, KSH_RETURN_ERROR | KSH_IGNORE_RDONLY);
}
/* only x[0] is ever exported, so use vpbase */