Patch from Stephen Wilson:

POSIX does not define sockaddr_un.sun_len.  Set only when required by
the platform.

llvm-svn: 122266
This commit is contained in:
Johnny Chen 2010-12-20 21:07:54 +00:00
parent eaff500c7b
commit a6846833ea
1 changed files with 2 additions and 0 deletions

View File

@ -432,7 +432,9 @@ ConnectionFileDescriptor::NamedSocketAccept (const char *socket_name, Error *err
saddr_un.sun_family = AF_UNIX;
::strncpy(saddr_un.sun_path, socket_name, sizeof(saddr_un.sun_path) - 1);
saddr_un.sun_path[sizeof(saddr_un.sun_path) - 1] = '\0';
#if defined(__APPLE__) || defined(__FreeBSD__)
saddr_un.sun_len = SUN_LEN (&saddr_un);
#endif
if (::bind (listen_socket, (struct sockaddr *)&saddr_un, SUN_LEN (&saddr_un)) == 0)
{