diff options
author | Vladimir Homutov <vl@nginx.com> | 2013-07-11 16:07:25 +0400 |
---|---|---|
committer | Vladimir Homutov <vl@nginx.com> | 2013-07-11 16:07:25 +0400 |
commit | af18946d769296d9efead825a0d1aa6a1a41fe74 (patch) | |
tree | 6b34cebcacea394e0126bcff647a3e73ab25c36d /src/core/ngx_connection.c | |
parent | 050f74b751c10eeb2491ec6509d0508a7e690209 (diff) |
Core: extended ngx_sock_ntop() with socklen parameter.
On Linux, sockaddr length is required to process unix socket addresses properly
due to unnamed sockets (which don't have sun_path set at all) and abstract
namespace sockets.
Diffstat (limited to 'src/core/ngx_connection.c')
-rw-r--r-- | src/core/ngx_connection.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/core/ngx_connection.c b/src/core/ngx_connection.c index 7ed781e0a..553a938f6 100644 --- a/src/core/ngx_connection.c +++ b/src/core/ngx_connection.c @@ -41,7 +41,7 @@ ngx_create_listening(ngx_conf_t *cf, void *sockaddr, socklen_t socklen) ls->sockaddr = sa; ls->socklen = socklen; - len = ngx_sock_ntop(sa, text, NGX_SOCKADDR_STRLEN, 1); + len = ngx_sock_ntop(sa, socklen, text, NGX_SOCKADDR_STRLEN, 1); ls->addr_text.len = len; switch (ls->sockaddr->sa_family) { @@ -152,7 +152,8 @@ ngx_set_inherited_sockets(ngx_cycle_t *cycle) return NGX_ERROR; } - len = ngx_sock_ntop(ls[i].sockaddr, ls[i].addr_text.data, len, 1); + len = ngx_sock_ntop(ls[i].sockaddr, ls[i].socklen, + ls[i].addr_text.data, len, 1); if (len == 0) { return NGX_ERROR; } @@ -1068,7 +1069,7 @@ ngx_connection_local_sockaddr(ngx_connection_t *c, ngx_str_t *s, return NGX_OK; } - s->len = ngx_sock_ntop(c->local_sockaddr, s->data, s->len, port); + s->len = ngx_sock_ntop(c->local_sockaddr, len, s->data, s->len, port); return NGX_OK; } |