diff --git a/util/sock.h b/util/sock.h index 408bdb94db9..0a51c04daaa 100644 --- a/util/sock.h +++ b/util/sock.h @@ -167,7 +167,7 @@ namespace mongo { case AF_INET: return inet_ntop(getType(), &as().sin_addr, buffer, addressSize); case AF_INET6: return inet_ntop(getType(), &as().sin6_addr, buffer, addressSize); #endif - case AF_UNIX: return as().sun_path; + case AF_UNIX: return (addressSize > 2 ?as().sun_path : "anonymous unix socket"); case AF_UNSPEC: return "(NONE)"; default: massert(SOCK_FAMILY_UNKNOWN_ERROR, "unsupported address family", false); return ""; }