[PATCH] connect's addrlen should be sizeof(local), not the contained path's length. Permits layer23 to work on OS X.

David Wilson dw at botanicus.net
Thu Dec 9 04:33:02 CET 2010


---
 src/host/layer23/src/common/l1l2_interface.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/host/layer23/src/common/l1l2_interface.c b/src/host/layer23/src/common/l1l2_interface.c
index e72b86e..08ef7be 100644
--- a/src/host/layer23/src/common/l1l2_interface.c
+++ b/src/host/layer23/src/common/l1l2_interface.c
@@ -118,9 +118,10 @@ int layer2_open(struct osmocom_ms *ms, const char *socket_path)
 	local.sun_path[sizeof(local.sun_path) - 1] = '\0';
 
 	rc = connect(ms->l2_wq.bfd.fd, (struct sockaddr *) &local,
-		     sizeof(local.sun_family) + strlen(local.sun_path));
+        sizeof(local));
 	if (rc < 0) {
-		fprintf(stderr, "Failed to connect to '%s'.\n", local.sun_path);
+		fprintf(stderr, "Failed to connect to '%s': %s\n", local.sun_path,
+			strerror(errno));
 		close(ms->l2_wq.bfd.fd);
 		return rc;
 	}
-- 
1.7.3.2


-- 
Computers are useless. They can only give you answers.
    -- Pablo Picasso 



More information about the baseband-devel mailing list