adding a new log-format escape

Wayne Davison wayned at
Mon Jun 27 17:27:32 GMT 2005

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 fmt value for internal purposes.  This code would
be better:

    if (S_ISREG(file->mode)) {
	n = buf2 + MAXPATHLEN - SUM_LENGTH * 2 - 1;
        for (j = 0; j < SUM_LENGTH; j++)
            sprintf(n + j * 2, "%02x", (uchar) file->u.sum[j]);
    } else
	n = "N/A";

This lets the existing code handle the "fmt" processing.  (The first
half of that "if" puts the 32 bytes of checksum data into the tail end
of buf2 and then lets the existing code format it into the start of


More information about the rsync mailing list