summaryrefslogtreecommitdiffhomepage
path: root/src/http/ngx_http_upstream_round_robin.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2008-08-21 18:47:23 +0000
committerIgor Sysoev <igor@sysoev.ru>2008-08-21 18:47:23 +0000
commit6a75019ad6847a5bf8c0dcd1f0ad87ed715add7e (patch)
treef7feb9bb2be60866bf079e19c0736dc0d3f160f3 /src/http/ngx_http_upstream_round_robin.c
parentbbe42c41e8f883185745706f92426aa9e73b3eab (diff)
downloadnginx-6a75019ad6847a5bf8c0dcd1f0ad87ed715add7e.tar.gz
nginx-6a75019ad6847a5bf8c0dcd1f0ad87ed715add7e.tar.bz2
*) remove zero termination in ngx_inet_ntop() and ngx_sock_ntop()
*) use ngx_snprintf() in ngx_inet_ntop() and ngx_sock_ntop() as they are called just once per connection *) NGX_INET_ADDRSTRLEN
Diffstat (limited to 'src/http/ngx_http_upstream_round_robin.c')
-rw-r--r--src/http/ngx_http_upstream_round_robin.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/http/ngx_http_upstream_round_robin.c b/src/http/ngx_http_upstream_round_robin.c
index e36e68529..d9450c95c 100644
--- a/src/http/ngx_http_upstream_round_robin.c
+++ b/src/http/ngx_http_upstream_round_robin.c
@@ -281,14 +281,14 @@ ngx_http_upstream_create_round_robin_peer(ngx_http_request_t *r,
for (i = 0; i < ur->naddrs; i++) {
- len = INET_ADDRSTRLEN - 1 + 1 + sizeof(":65536") - 1;
+ len = NGX_INET_ADDRSTRLEN + sizeof(":65536") - 1;
p = ngx_pnalloc(r->pool, len);
if (p == NULL) {
return NGX_ERROR;
}
- len = ngx_inet_ntop(AF_INET, &ur->addrs[i], p, INET_ADDRSTRLEN);
+ len = ngx_inet_ntop(AF_INET, &ur->addrs[i], p, NGX_INET_ADDRSTRLEN);
len = ngx_sprintf(&p[len], ":%d", ur->port) - p;
sin = ngx_pcalloc(r->pool, sizeof(struct sockaddr_in));