summaryrefslogtreecommitdiffstats
path: root/src/host/layer23/src/common/l1l2_interface.c
diff options
context:
space:
mode:
authorDavid Wilson <dw@botanicus.net>2010-12-09 03:33:02 +0000
committerHarald Welte <laforge@gnumonks.org>2010-12-11 11:31:57 +0800
commit80600c5a08e382b7749bc1305814b0670f07330b (patch)
treea62176a9f42055067ae9370aa82f5a9e3ef32b1f /src/host/layer23/src/common/l1l2_interface.c
parentcef26cd2f529b574a880e39f0dec6d7996119cd3 (diff)
layer23: use correct sizeof(sockaddr) for connecting to L1CTL socket
connect's addrlen should be sizeof(local), not the contained path's length. With the previous code, on OS X connect() will fail with ENOENT. This permits layer23 to work on OS X using the pl2303 driver, /dev/tty.usbserial , MacPorts arm-elf-gcc and RANLIB=arm-elf-ranlib Signed-off-by: Harald Welte <laforge@gnumonks.org>
Diffstat (limited to 'src/host/layer23/src/common/l1l2_interface.c')
-rw-r--r--src/host/layer23/src/common/l1l2_interface.c5
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 e72b86ed..74c88754 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;
}