>>>>> "Eirik" == Eirik Byrkjeflot Anonsen <[EMAIL PROTECTED]> writes:

>> The size passed to connect() should be the same as that passed to
>> bind() by the server, which would be 'strlen(file) + 1 +
>> offsetof(struct sockaddr_un, sun_path)', and not sizeof(addr), for
>> some reason.  See TRANS(SocketUNIXCreateListener) in Xtranssock.c.

Eirik> Could that be related to this quote from "man unix": "Note that
Eirik> names in the abstract namespace are not zero-terminated."

Yes, taht is exactly the issue.  The abstract sockets use Pascal-style
strings (lenght+data) rather than C-style (NULL-terminated), but with
the complication that the lenght is the used lenght of the whole struct
rather than just of the string.  Hense the need for offsetof¹.

-JimC

1]  If you know the strlen(3) of the name you could create a struct of
    just the right size, but that would require open-coding the struct
    rather than using the definition in the system include file.

-- 
James Cloos <[EMAIL PROTECTED]>         OpenPGP: 1024D/ED7DAEA6
_______________________________________________
xorg mailing list
xorg@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xorg

Reply via email to