Mark Kettenis <[email protected]> writes: > Keith. This implementation isn't quite right as it doesn't use the > proper CMSG_ macros to manipulate the ancillary data object > information. You get way with this on Linux, because it deviates from > POSIX and declares the cmsg_len member as size_t, which means no > additional padding between the cmsghdr and the data array is > necessary. But on other systems this code won't work. Attached is an > (untested) diff that should fix this. If you didn't do so yet, please > read appendix A of RFC 3542, which has a decent description of the > API.
Yeah, I'm afraid that API didn't make any sense to me, so I just made it work in the only environment I had available. If you've got something that works differently and can test it, please send patches along. > I also believe the handling of MSG_TRUNC and MSG_CTRUNC isn't correct, > and will result in leaked file descriptors. If I read the Linux > kernel code correctly MSG_CTRUNC gets set when there is not enough > room to store all filedescriptors. The upper levels of the code are careful to not send more descriptors than the other end is willing to accept, so yeah, treating these cases as errors (to the point of just closing the client connection) would be sufficient. -- [email protected]
pgpL2eTxW8wje.pgp
Description: PGP signature
_______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
