[MERGED] osmo-trx[master]: Sockets.cpp: Fix initialization of UDD socket

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Fri Jan 12 13:07:22 UTC 2018


Harald Welte has submitted this change and it was merged.

Change subject: Sockets.cpp: Fix initialization of UDD socket
......................................................................


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
---
M CommonLibs/Sockets.cpp
1 file changed, 1 insertion(+), 0 deletions(-)

Approvals:
  Vadim Yanitskiy: Looks good to me, but someone else must approve
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/CommonLibs/Sockets.cpp b/CommonLibs/Sockets.cpp
index a65d62b..11e96dd 100644
--- a/CommonLibs/Sockets.cpp
+++ b/CommonLibs/Sockets.cpp
@@ -324,6 +324,7 @@
 void UDDSocket::destination(const char* remotePath)
 {
 	struct sockaddr_un* unAddr = (struct sockaddr_un*)mDestination;
+	unAddr->sun_family = AF_UNIX;
 	strcpy(unAddr->sun_path,remotePath);
 }
 

-- 
To view, visit https://gerrit.osmocom.org/5710
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I6e1b7e743a781abdcf69aa9842b30be893633433
Gerrit-PatchSet: 2
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>



More information about the gerrit-log mailing list