Subject: Re: Adding /proc/swaps to linux compat code
To: Christian Biere <email@example.com>
From: Arnaud Lacombe <firstname.lastname@example.org>
Date: 02/01/2007 19:11:04
On Thu, Feb 01, 2007 at 10:03:10PM +0000, David Laight wrote:
> On Thu, Feb 01, 2007 at 12:11:36AM +0100, Christian Biere wrote:
> > Arnaud Lacombe wrote:
> > > A first patch is available here:
> > > http://www.sigfpe.info/netbsd/proc_swaps.diff
> > * You should check the return value of snprintf() with "<= 0" instead of "== 0".
> > At least when remaining reached zero, snprintf() will return -1 and not 0.
> Will it? Does a conformant  snprintf() ever return -1 ?
> Time to RTFM...
libc' snprintf can return -1 at least with negative `len' and set
`errno' to EINVAL.
libsa' snprintf ends up in vsnprintf() which return `sbuf - buf', `buf'
is our buffer, `sbuf' is a cursor inside the buffer, so it can't