Date: Wed, 2 Mar 2005 14:26:29 -0800 (PST) From: Nine Forty <pm940@yahoo.com> To: freebsd-questions@freebsd.org Subject: SUN_LEN(addr) vs. SUN_LEN(addr) + 1. Message-ID: <20050302222629.82196.qmail@web54002.mail.yahoo.com>
next in thread | raw e-mail | index | archive | help
/usr/include/sys/un.h says: /* * Definitions for UNIX IPC domain. */ struct sockaddr_un { u_char sun_len; /* sockaddr len including null */ u_char sun_family; /* AF_UNIX */ char sun_path[104]; /* path name (gag) */ }; ... but it also says: /* actual length of an initialized sockaddr_un */ #define SUN_LEN(su) \ (sizeof(*(su)) - sizeof((su)->sun_path) + strlen((su)->sun_path)) Which doesn't include the nul at the end of sun_path. When calling bind(2) or sendmsg(2), is SUN_LEN(addr) valid, or should it be SUN_LEN(addr) + 1? Various programs under /usr/src use plain SUN_LEN(addr). Is there a problem with the comment, the macro, the applications, or none of the above? Thanks. __________________________________ Celebrate Yahoo!'s 10th Birthday! Yahoo! Netrospective: 100 Moments of the Web http://birthday.yahoo.com/netrospective/
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050302222629.82196.qmail>