From 5a190aa53b85e9d778630358a2b572343ea84046 Mon Sep 17 00:00:00 2001 From: drochner Date: Thu, 20 Jan 2011 21:26:20 +0000 Subject: [PATCH] fix bug introduced in rev. 1.3: need to set the string before converting it into a numerical value, otherwise we might get junk or crash --- external/historical/nawk/dist/tran.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/external/historical/nawk/dist/tran.c b/external/historical/nawk/dist/tran.c index e9515ceabb78..449855f81f68 100644 --- a/external/historical/nawk/dist/tran.c +++ b/external/historical/nawk/dist/tran.c @@ -353,6 +353,7 @@ char *setsval(Cell *vp, const char *s) /* set string val of a Cell */ dprintf( ("setsval %p: %s = \"%s (%p) \", t=%o r,f=%d,%d\n", vp, NN(vp->nval), t,t, vp->tval, donerec, donefld) ); + vp->sval = t; if (&vp->fval == NF) { donerec = 0; /* mark $0 invalid */ f = getfval(vp); @@ -360,7 +361,7 @@ char *setsval(Cell *vp, const char *s) /* set string val of a Cell */ dprintf( ("setting NF to %g\n", f) ); } - return(vp->sval = t); + return(vp->sval); } Awkfloat getfval(Cell *vp) /* get float val of a Cell */