diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-12-15 01:40:18 +0100 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-12-15 01:40:18 +0100 |
commit | 2aa6b4cfc90089c57b5d9baf536a91fc2077204d (patch) | |
tree | b6ae903223a8a30b9f49b1769f5cb856ab41a9bc /nsprpub/pr/src | |
parent | f5c87ba9377dbc9363ed82e3684b631fefe2cbbd (diff) | |
download | uxp-2aa6b4cfc90089c57b5d9baf536a91fc2077204d.tar.gz |
Update NSPR to 4.20
Diffstat (limited to 'nsprpub/pr/src')
-rw-r--r-- | nsprpub/pr/src/misc/prnetdb.c | 16 | ||||
-rw-r--r-- | nsprpub/pr/src/pthreads/ptio.c | 7 | ||||
-rw-r--r-- | nsprpub/pr/src/pthreads/ptsynch.c | 3 |
3 files changed, 23 insertions, 3 deletions
diff --git a/nsprpub/pr/src/misc/prnetdb.c b/nsprpub/pr/src/misc/prnetdb.c index affebf6ac3..c482e8e4a6 100644 --- a/nsprpub/pr/src/misc/prnetdb.c +++ b/nsprpub/pr/src/misc/prnetdb.c @@ -7,6 +7,10 @@ #include <string.h> +#if defined(LINUX) +#include <sys/un.h> +#endif + /* * On Unix, the error code for gethostbyname() and gethostbyaddr() * is returned in the global variable h_errno, instead of the usual @@ -1366,7 +1370,17 @@ PRUintn _PR_NetAddrSize(const PRNetAddr* addr) #endif #if defined(XP_UNIX) || defined(XP_OS2) else if (AF_UNIX == addr->raw.family) - addrsize = sizeof(addr->local); + { +#if defined(LINUX) + if (addr->local.path[0] == 0) + /* abstract socket address is supported on Linux only */ + addrsize = strnlen(addr->local.path + 1, + sizeof(addr->local.path)) + + offsetof(struct sockaddr_un, sun_path) + 1; + else +#endif + addrsize = sizeof(addr->local); + } #endif else addrsize = 0; diff --git a/nsprpub/pr/src/pthreads/ptio.c b/nsprpub/pr/src/pthreads/ptio.c index f6aa567418..1549a905fb 100644 --- a/nsprpub/pr/src/pthreads/ptio.c +++ b/nsprpub/pr/src/pthreads/ptio.c @@ -1750,7 +1750,12 @@ static PRStatus pt_Bind(PRFileDesc *fd, const PRNetAddr *addr) if (addr->raw.family == AF_UNIX) { /* Disallow relative pathnames */ - if (addr->local.path[0] != '/') + if (addr->local.path[0] != '/' +#if defined(LINUX) + /* Linux has abstract socket address support */ + && addr->local.path[0] != 0 +#endif + ) { PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0); return PR_FAILURE; diff --git a/nsprpub/pr/src/pthreads/ptsynch.c b/nsprpub/pr/src/pthreads/ptsynch.c index a93b74795e..126bed6704 100644 --- a/nsprpub/pr/src/pthreads/ptsynch.c +++ b/nsprpub/pr/src/pthreads/ptsynch.c @@ -911,7 +911,8 @@ PR_IMPLEMENT(PRStatus) PR_DeleteSemaphore(const char *name) * From the semctl(2) man page in glibc 2.0 */ #if (defined(__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED)) \ - || defined(FREEBSD) || defined(OPENBSD) || defined(BSDI) \ + || (defined(FREEBSD) && __FreeBSD_version < 1200059) \ + || defined(OPENBSD) || defined(BSDI) \ || defined(DARWIN) || defined(SYMBIAN) /* union semun is defined by including <sys/sem.h> */ #else |