pkgsrc-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
lua-socket vs sockaddr_un
When building net/lua-socket, defining UNIX_HAS_SUN_LEN alters the size
passed to socket_bind() to take into account the difference in definitions
of sockaddr_un on Linux vs other OSes:
https://github.com/lunarmodules/luasocket/blob/4844a48fbf76b0400fd7b7e4d15d244484019df1/src/unixstream.c#L191-L199
If the platform (PLAT) is set to macos or freebsd, UNIX_HAS_SUN_LEN is
defined:
https://github.com/lunarmodules/luasocket/blob/4844a48fbf76b0400fd7b7e4d15d244484019df1/src/makefile#L190-L201
However, pkgsrc does not set the platform and so it defaults to linux,
meaning UNIX_HAS_SUN_LEN is not defined and therefore the filename of the
socket gets truncated. As pkgsrc is cross-platform, it's probably OK to
carry on with PLAT=linux, but set UNIX_HAS_SUN_LEN based on PLATFORM in
the Makefile.
On the other hand, this also just looks like over-engineering in
luasocket to me. What's wrong with just using sizeof(sockaddr_un)
unconditionally? Even taking the BUGS section of the relevant Linux man
page into account, the length check and memcpy() calls should be OK.
https://man7.org/linux/man-pages/man7/unix.7.html#BUGS
--
Stephen
Home |
Main Index |
Thread Index |
Old Index