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>
This commit is contained in:
parent
cef26cd2f5
commit
80600c5a08
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue