common: Don't use the trailing null with unix socket paths
authorJan Ekström <jan.ekstrom@intel.com>
Thu, 7 Aug 2014 10:43:45 +0000 (13:43 +0300)
committerKrisztian Litkey <krisztian.litkey@intel.com>
Wed, 20 Aug 2014 09:45:43 +0000 (12:45 +0300)
Affects {stream,dgram}-transport; Bind/connect doesn't ignore/
remove the null, and most things don't have a null at the end
of the socket's path.

src/common/dgram-transport.c
src/common/stream-transport.c

index 619c3d4..0bd94bb 100644 (file)
@@ -227,6 +227,10 @@ static socklen_t dgrm_resolve(const char *str, mrp_sockaddr_t *addr,
             if (un->sun_path[0] == '@')
                 un->sun_path[0] = '\0';
         }
+
+        /* When binding the socket, we don't need the null at the end */
+        len--;
+
         break;
 
     case AF_INET:
index ce43587..93423de 100644 (file)
@@ -219,6 +219,10 @@ static socklen_t strm_resolve(const char *str, mrp_sockaddr_t *addr,
             if (un->sun_path[0] == '@')
                 un->sun_path[0] = '\0';
         }
+
+        /* When binding the socket, we don't need the null at the end */
+        len--;
+
         break;
 
     case AF_INET: