Hi All,
I found a defect in function "ngx_vslprintf”which doesn't support right
alignment format of a string, such as "%40s", as purported in the comments
right above the function "ngx_sprintf" in file "src/core/ngx_string.c".
The following is my suggested fix in function "ngx_vslprintf ":
......
case 's':
p = va_arg(args, u_char *);
//
// Added by Gary Hu
//
size_t sublen;
size_t padlen;
sublen = ngx_strlen(p);
/* Add padding whitespaces to the output buffer to achieve
right alignment*/
if (width > 0 && width > sublen)
{
padlen = ngx_min(((size_t) (last - buf)), width - sublen
);
ngx_memset(buf, ' ', padlen);
buf += padlen;
}
//
// End added by Gary Hu
//
if (slen == (size_t) -1) {
while (*p && buf < last) {
*buf++ = *p++;
}
} else {
len = ngx_min(((size_t) (last - buf)), slen);
buf = ngx_cpymem(buf, p, len);
}
fmt++;
continue;
case 'O':
......
Best Regards,
Gary Hu
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://nginx.org/mailman/listinfo/nginx-devel