Re: adding a new log-format escape

2005-06-27 Thread Wayne Davison
On Mon, Jun 27, 2005 at 10:56:41AM -0600, Andrew Shewmaker wrote: > + strlcat(fmt, "02x", sizeof fmt); The purpose of the fmt buffer is to allow the user to specify something like %-20s and get the output formatted into their log line, so you shouldn't be using the fm

Re: adding a new log-format escape

2005-06-27 Thread Andrew Shewmaker
On 6/27/05, Wayne Davison <[EMAIL PROTECTED]> wrote: > On Mon, Jun 27, 2005 at 09:22:25AM -0700, Wayne Davison wrote: > > so you need to be sure to check for this and print some other > > value ("N/A") for entries with a NULL pointer. > > Actually, the proper fix is to check the mode using S_ISREG

Re: adding a new log-format escape

2005-06-27 Thread Andrew Shewmaker
On 6/27/05, Paul Slootman <[EMAIL PROTECTED]> wrote: > On Mon 27 Jun 2005, YOSHIFUJI Hideaki / ?$B5HF#1QL@ wrote: > > In article <[EMAIL PROTECTED]> (at Mon, 27 Jun 2005 00:07:19 -0600), Andrew > > Shewmaker <[EMAIL PROTECTED]> says: > > > > > + for (j = 0; j < SUM_LENGTH; j+

Re: adding a new log-format escape

2005-06-27 Thread Wayne Davison
On Mon, Jun 27, 2005 at 09:22:25AM -0700, Wayne Davison wrote: > so you need to be sure to check for this and print some other > value ("N/A") for entries with a NULL pointer. Actually, the proper fix is to check the mode using S_ISREG() and only ever dereference "u.sum" for a regular file (since

Re: adding a new log-format escape

2005-06-27 Thread Wayne Davison
On Mon, Jun 27, 2005 at 12:07:19AM -0600, Andrew Shewmaker wrote: > + for (j = 0; j < SUM_LENGTH; j++ ) { > + snprintf(buf2 + j * 2, sizeof buf2, fmt, > file->u.sum[j]); Not every entry will have a non-zero "sum" pointer (e.g. symlinks, dirs, et

Re: adding a new log-format escape

2005-06-27 Thread Paul Slootman
On Mon 27 Jun 2005, YOSHIFUJI Hideaki / ?$B5HF#1QL@ wrote: > In article <[EMAIL PROTECTED]> (at Mon, 27 Jun 2005 00:07:19 -0600), Andrew > Shewmaker <[EMAIL PROTECTED]> says: > > > + for (j = 0; j < SUM_LENGTH; j++ ) { > > + snprintf(buf2 + j *

Re: adding a new log-format escape

2005-06-26 Thread YOSHIFUJI Hideaki / 吉藤英明
In article <[EMAIL PROTECTED]> (at Mon, 27 Jun 2005 00:07:19 -0600), Andrew Shewmaker <[EMAIL PROTECTED]> says: > + for (j = 0; j < SUM_LENGTH; j++ ) { > + snprintf(buf2 + j * 2, sizeof buf2, > fmt, file->u.sum[j]); file->u.sum[j] & 0xff