Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Nov 1998 16:57:47 -0800 (PST)
From:      Archie Cobbs <archie@whistle.com>
To:        grog@lemis.com (Greg Lehey)
Cc:        freebsd-current@FreeBSD.ORG
Subject:   Re: snprintf() in the kernel
Message-ID:  <199811200057.QAA29023@bubba.whistle.com>
In-Reply-To: <19981120093817.K467@freebie.lemis.com> from Greg Lehey at "Nov 20, 98 09:38:17 am"

next in thread | previous in thread | raw e-mail | index | archive | help
Greg Lehey writes:
> > I count 131 files that use sprintf() and 28 that use strcat(), so
> > this will touch a lot of files (but hopefully for the better).
> 
> I'm very much in favour.  The code I need to do bounds checking in
> vinum is some of the ugliest I've seen.  

Cool.. I know the feeling.

The only subtle gotcha with snprintf() is that it returns
the number of characters that *would* have been printed,
not the number that actually were printed. So you can't
count on the return value being less than the buffer size.

> > So.. does anyone have a huge problem with doing this before I jump in?
> > [ Anyone willing to review for me? ]
> 
> I'll take a look.  Are you going to implement %qd while you're at it?

One thing at a time.. :-) Thanks for the offers from you and
Robert Nordier to review, you folks will hear from me soon.. 

-Archie

___________________________________________________________________________
Archie Cobbs   *   Whistle Communications, Inc.  *   http://www.whistle.com

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199811200057.QAA29023>