From 2edbe4d366fcc9c340093d6daedcb08b1f62911f Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Tue, 9 Jan 2018 20:15:15 +0100 Subject: [PATCH] Sockets.cpp: Fix initialization of UDD socket Without this line, destination address for a UDD socket is left with incorrect value AF_UNSPEC. Later on when calling DatagramSocket:write(), sendto() fails with EINVAL. This commit fixes test SocketsTest.cpp. Change-Id: I6e1b7e743a781abdcf69aa9842b30be893633433 --- CommonLibs/Sockets.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/CommonLibs/Sockets.cpp b/CommonLibs/Sockets.cpp index a65d62b7..11e96ddc 100644 --- a/CommonLibs/Sockets.cpp +++ b/CommonLibs/Sockets.cpp @@ -324,6 +324,7 @@ void UDDSocket::open(const char* localPath) void UDDSocket::destination(const char* remotePath) { struct sockaddr_un* unAddr = (struct sockaddr_un*)mDestination; + unAddr->sun_family = AF_UNIX; strcpy(unAddr->sun_path,remotePath); }