Fix unix socket access on FreeBSD (#5756)
Vladimir Kobal committed
Apr 3, 2019 at 11:34 UTC
f50a0104028c7f192f0539d54343bf2d3a2aceb3
1 file changed
+5
libnetdata/socket/socket.c
+5
@@ -944,6 +944,11 @@ int accept_socket(int fd, int flags, char *client_ip, size_t ipsize, char *clien
944
strncpyz(client_port, "UNKNOWN", portsize - 1);
945
}
946
947
+#ifdef __FreeBSD__
948
+ if(((struct sockaddr *)&sadr)->sa_family == AF_LOCAL)
949
+ strncpyz(client_ip, "localhost", ipsize);
950
+#endif
951
+
952
client_ip[ipsize - 1] = '\0';
953
client_port[portsize - 1] = '\0';
954