summaryrefslogtreecommitdiffstats
path: root/nsprpub/pr/src/misc/prnetdb.c
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-12-15 01:40:18 +0100
committerwolfbeast <mcwerewolf@gmail.com>2018-12-15 01:40:18 +0100
commit09ef48bd005a7f9e97a3fe797a079fcf2b5e58d3 (patch)
treeb6ae903223a8a30b9f49b1769f5cb856ab41a9bc /nsprpub/pr/src/misc/prnetdb.c
parent023af95abeb4a9bd61665f37fc8dec173e0f2f4a (diff)
downloadUXP-09ef48bd005a7f9e97a3fe797a079fcf2b5e58d3.tar
UXP-09ef48bd005a7f9e97a3fe797a079fcf2b5e58d3.tar.gz
UXP-09ef48bd005a7f9e97a3fe797a079fcf2b5e58d3.tar.lz
UXP-09ef48bd005a7f9e97a3fe797a079fcf2b5e58d3.tar.xz
UXP-09ef48bd005a7f9e97a3fe797a079fcf2b5e58d3.zip
Update NSPR to 4.20
Diffstat (limited to 'nsprpub/pr/src/misc/prnetdb.c')
-rw-r--r--nsprpub/pr/src/misc/prnetdb.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/nsprpub/pr/src/misc/prnetdb.c b/nsprpub/pr/src/misc/prnetdb.c
index affebf6ac..c482e8e4a 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;