fixing socket name

willem itsme at
Mon Mar 29 14:39:31 UTC 2010

On 2010-03-29 12:52:11, Holger Freyther wrote:
> On Monday 29 March 2010 12:39:48 willem wrote:
>> the /tmp/osmoncon*  sockets created by osmocon are created one character
>> too short.
> Can you explain?

the sockaddr struct for named sockets is defined like this ( on my mac )

struct    sockaddr_un {
    unsigned char    sun_len;    /* sockaddr len including null */
    sa_family_t    sun_family;    /* [XSI] AF_UNIX */
    char        sun_path[104];    /* [XSI] path name (gag) */

the sun_len value is ignored.
but the total length of the struct passed to bind / connect
should include it.

without this fix, the second time i run './osmocon'  it will complain:
Failed to bind the unix domain socket
since it tried to unlink the correct name, but called bind with a one
char too short name.


More information about the baseband-devel mailing list