Translate the leading NUL (aka ^@, '\0') of abstract Unix sockets into @ for user visible strings, since @ is readable by all tools.
Co-developed-by: Andrew Clayton <a.clay...@f5.com> Signed-off-by: Andrew Clayton <a.clay...@f5.com> Signed-off-by: Alejandro Colomar <alx.manpa...@gmail.com> Cc: Bjornar Ness <bjornar.n...@gmail.com> --- src/core/ngx_inet.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/core/ngx_inet.c b/src/core/ngx_inet.c index 4a455e5b..bf1799d4 100644 --- a/src/core/ngx_inet.c +++ b/src/core/ngx_inet.c @@ -244,6 +244,11 @@ ngx_sock_ntop(struct sockaddr *sa, socklen_t socklen, u_char *text, size_t len, if (socklen <= (socklen_t) offsetof(struct sockaddr_un, sun_path)) { p = ngx_snprintf(text, len, "unix:%Z"); + } else if (saun->sun_path[0] == '\0') { + n = strnlen(&saun->sun_path[1], + socklen - offsetof(struct sockaddr_un, sun_path) - 1); + p = ngx_snprintf(text, len, "unix:@%*s%Z", n, &saun->sun_path[1]); + } else { n = ngx_strnlen((u_char *) saun->sun_path, socklen - offsetof(struct sockaddr_un, sun_path)); -- 2.37.2 _______________________________________________ nginx-devel mailing list -- nginx-devel@nginx.org To unsubscribe send an email to nginx-devel-le...@nginx.org