fixing socket name

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/baseband-devel@lists.osmocom.org/.

willem itsme at xs4all.nl
Mon Mar 29 10:39:48 UTC 2010


the /tmp/osmoncon*  sockets created by osmocon are created one character
too short.

willem


fix:

diff --git a/src/host/layer23/src/main.c b/src/host/layer23/src/main.c
index 8e76e8b..9e37fbf 100644
--- a/src/host/layer23/src/main.c
+++ b/src/host/layer23/src/main.c
@@ -244,7 +244,7 @@ int main(int argc, char **argv)
     local.sun_path[sizeof(local.sun_path) - 1] = '\0';
 
     rc = connect(ms->wq.bfd.fd, (struct sockaddr *) &local,
-             sizeof(local.sun_family) + strlen(local.sun_path));
+             sizeof(local.sun_family) + strlen(local.sun_path) + 1);
     if (rc < 0) {
         fprintf(stderr, "Failed to connect to '%s'.\n", local.sun_path);
         exit(1);
diff --git a/src/host/osmocon/osmocon.c b/src/host/osmocon/osmocon.c
index f934dd7..b361eb1 100644
--- a/src/host/osmocon/osmocon.c
+++ b/src/host/osmocon/osmocon.c
@@ -629,7 +632,7 @@ static int register_tool_server(struct tool_server *ts,
     local.sun_path[sizeof(local.sun_path) - 1] = '\0';
     unlink(local.sun_path);
     rc = bind(bfd->fd, (struct sockaddr *) &local,
-          sizeof(local.sun_family) + strlen(local.sun_path));
+          sizeof(local.sun_family) + strlen(local.sun_path) + 1);
     if (rc != 0) {
         fprintf(stderr, "Failed to bind the unix domain socket. '%s'\n",
             local.sun_path);
diff --git a/src/host/osmocon/osmoload.c b/src/host/osmocon/osmoload.c
index ecee8b3..fdf417a 100644
--- a/src/host/osmocon/osmoload.c
+++ b/src/host/osmocon/osmoload.c
@@ -128,7 +128,7 @@ loader_connect(const char *socket_path) {
     }
 
     rc = connect(conn->fd, (struct sockaddr *) &local,
-                 sizeof(local.sun_family) + strlen(local.sun_path));
+                 sizeof(local.sun_family) + strlen(local.sun_path) + 1);
     if (rc < 0) {
         fprintf(stderr, "Failed to connect to '%s'.\n", local.sun_path);
         exit(1);





More information about the baseband-devel mailing list