Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/historical/nawk/dist fix bug introduced in rev. 1.3...



details:   https://anonhg.NetBSD.org/src/rev/2da4a4530f05
branches:  trunk
changeset: 761219:2da4a4530f05
user:      drochner <drochner%NetBSD.org@localhost>
date:      Thu Jan 20 21:26:20 2011 +0000

description:
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

diffstat:

 external/historical/nawk/dist/tran.c |  3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diffs (20 lines):

diff -r 94caa7b8c584 -r 2da4a4530f05 external/historical/nawk/dist/tran.c
--- a/external/historical/nawk/dist/tran.c      Thu Jan 20 21:23:11 2011 +0000
+++ b/external/historical/nawk/dist/tran.c      Thu Jan 20 21:26:20 2011 +0000
@@ -353,6 +353,7 @@
           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 @@
                dprintf( ("setting NF to %g\n", f) );
        }
 
-       return(vp->sval = t);
+       return(vp->sval);
 }
 
 Awkfloat getfval(Cell *vp)     /* get float val of a Cell */



Home | Main Index | Thread Index | Old Index