summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2000-11-21 23:12:05 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2000-11-21 23:12:05 +0000
commitf9ff957831f96886025ddf86479739a2fc55a95f (patch)
tree282bd51f1ef13797c0d8750b2948f3774d650df6 /bin
parenta43ea2cdf28fb18264ce09f7a79b8f8595b78133 (diff)
Bug fixes from pdksh-5.2.14-patches.1:
o set -x dumps core (shf.c); o "typeset -r foo=bar" fails saying foo is readonly (var.c).
Diffstat (limited to 'bin')
-rw-r--r--bin/ksh/shf.c3
-rw-r--r--bin/ksh/var.c10
2 files changed, 7 insertions, 6 deletions
diff --git a/bin/ksh/shf.c b/bin/ksh/shf.c
index e3b27a1bd07..fc507a6e2a5 100644
--- a/bin/ksh/shf.c
+++ b/bin/ksh/shf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: shf.c,v 1.6 1999/06/15 01:18:36 millert Exp $ */
+/* $OpenBSD: shf.c,v 1.7 2000/11/21 23:12:04 millert Exp $ */
/*
* Shell file I/O routines
@@ -357,7 +357,6 @@ shf_emptybuf(shf, flags)
shf->rp = nbuf + (shf->rp - shf->buf);
shf->wp = nbuf + (shf->wp - shf->buf);
shf->rbsize += shf->wbsize;
- shf->wbsize += shf->wbsize;
shf->wnleft += shf->wbsize;
shf->wbsize *= 2;
shf->buf = nbuf;
diff --git a/bin/ksh/var.c b/bin/ksh/var.c
index 71ddc4f9d2e..4ce18214597 100644
--- a/bin/ksh/var.c
+++ b/bin/ksh/var.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: var.c,v 1.10 1999/06/15 01:18:36 millert Exp $ */
+/* $OpenBSD: var.c,v 1.11 2000/11/21 23:12:04 millert Exp $ */
#include "sh.h"
#include "ksh_time.h"
@@ -357,7 +357,9 @@ setstr(vq, s, error_ok)
const char *s;
int error_ok;
{
- if (vq->flag & RDONLY) {
+ int no_ro_check = error_ok & 0x4;
+ error_ok &= ~0x4;
+ if ((vq->flag & RDONLY) && !no_ro_check) {
warningf(TRUE, "%s: is read only", vq->name);
if (!error_ok)
errorf(null);
@@ -719,13 +721,13 @@ typeset(var, set, clr, field, base)
if (val != NULL) {
if (vp->flag&INTEGER) {
/* do not zero base before assignment */
- setstr(vp, val, KSH_UNWIND_ERROR);
+ setstr(vp, val, KSH_UNWIND_ERROR | 0x4);
/* 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);
+ setstr(vp, val, KSH_RETURN_ERROR | 0x4);
}
/* only x[0] is ever exported, so use vpbase */