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
This commit is contained in:
Pau Espin 2018-01-09 20:15:15 +01:00
parent a3694bd303
commit 2edbe4d366
1 changed files with 1 additions and 0 deletions

View File

@ -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);
}