Subject: Re: Adding /proc/swaps to linux compat code
To: None <>
From: Christian Biere <>
List: tech-kern
Date: 02/01/2007 00:11:36
Arnaud Lacombe wrote:
> A first patch is available here:

 * 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.

 * totallen and remaining are completely redundant. Use the difference to an
   "endptr" instead.

 * The short-cut nswap is unnecessary and doesn't really pay off here.

 * You should return some error code instead of zero if the buffer is really to

 * This is clearer:
   struct swapent *sep0;
   const struct swapent *sep;

 * Use M_ZERO instead of memset().