*BSD News Article 13168


Return to BSD News archive

Newsgroups: comp.os.386bsd.bugs
Path: sserve!newshost.anu.edu.au!munnari.oz.au!uunet!mcsun!ieunet!dec4ie.ieunet.ie!jkh
From: jkh@whisker.lotus.ie (Jordan K. Hubbard)
Subject: WARNING: 0.2.2 contains broken strtod()!
Message-ID: <JKH.93Mar21225040@whisker.lotus.ie>
Sender: usenet@ieunet.ie (USENET News System)
Nntp-Posting-Host: whisker.lotus.ie
Organization: Lotus Development Ireland
Date: Sun, 21 Mar 1993 22:50:40 GMT
Lines: 51

Wouldn't ya just know it - I didn't have the need to recompile wish
(from tk 3.2) until *just now*.  When, of course, I find that the
strtod we provided in patch00089 is broken..  The problem is that it
returns an endp that is advanced just one character too far, causing
all kinds of confusion.

Temporary solution:  Avoid strtod() or at least the second argument to
strtod() until I can issue a patch.  If you simply MUST use it, and need
a valid endp, then apply the patch at the end of this message.


NOTE: DO NOT APPLY THIS PATCH UNLESS YOU'RE WILLING TO CARRY OUT THE NEXT
THREE STEPS:

1.  Back up your current copy of /usr/src/lib/libc/i386/stdlib/atof.c

2.  Apply the change below.

3.  Before you apply the next set of patches from me, restore the old
    copy.

You *must* remember to perform step 3 before the next patch release since
I will probably elect to fix this problem as part of some other, larger,
patch rather than replacing patch 89 (which annoys many people).  If
you've changed the version of atof.c I expect to find (the broken one),
the patch will then fail.  Please don't bother fixing this now if you
don't think you'll remember to do this later!  Thanks!

*** /usr1/src/lib/libc/i386/stdlib/atof.c.orig	Sun Mar 21 22:49:53 1993
--- /usr1/src/lib/libc/i386/stdlib/atof.c	Sun Mar 21 22:33:48 1993
***************
*** 166,172 ****
  	fl = ldexp(fl, bexp);
  
  	if(endp)
! 		*endp = p;
  	return neg < 0 ? -fl : fl;
  }
  
--- 166,172 ----
  	fl = ldexp(fl, bexp);
  
  	if(endp)
! 		*endp = --p;
  	return neg < 0 ? -fl : fl;
  }
  
--
Jordan Hubbard          Lotus Development Ireland       jkh@whisker.lotus.ie
386bsd Patchkit Coordinator                             All-around nice dude.
I do not speak for Lotus as that's not in my job description.