Bug 97475: some platforms, such as OpenVMS, require us to pass the exact

socket address length to socket functions like accept.  Just fixed enough
of this problem for OJI to work with Mozilla on OpenVMS.
Modified Files: _openvms.h primpl.h ptio.c
This commit is contained in:
wtc%netscape.com 2002-06-13 18:05:26 +00:00
Родитель a439879c74
Коммит 5d776923e8
3 изменённых файлов: 26 добавлений и 0 удалений

Просмотреть файл

@ -97,6 +97,7 @@ struct ip_mreq {
#define _PR_USE_POLL
#define _PR_STAT_HAS_ONLY_ST_ATIME
#define _PR_NO_LARGE_FILES
#define _PR_STRICT_ADDR_LEN
/* IPv6 support */
#ifdef _SOCKADDR_LEN

Просмотреть файл

@ -1714,6 +1714,13 @@ struct PRFilePrivate {
#endif
#if !defined(XP_UNIX) /* BugZilla: 4090 */
PRBool appendMode;
#endif
#ifdef _PR_STRICT_ADDR_LEN
PRUint16 af; /* If the platform requires passing the exact
* length of the sockaddr structure for the
* address family of the socket to socket
* functions like accept(), we need to save
* the address family of the socket. */
#endif
_MDFileDesc md;
};

Просмотреть файл

@ -1628,6 +1628,18 @@ static PRFileDesc* pt_Accept(
if (pt_TestAbort()) return newfd;
#ifdef _PR_STRICT_ADDR_LEN
if (addr)
{
/*
* Set addr->raw.family just so that we can use the
* PR_NETADDR_SIZE macro.
*/
addr->raw.family = fd->secret->af;
addr_len = PR_NETADDR_SIZE(addr);
}
#endif
osfd = accept(fd->secret->md.osfd, (struct sockaddr*)addr, &addr_len);
syserrno = errno;
@ -3417,6 +3429,9 @@ PR_IMPLEMENT(PRFileDesc*) PR_Socket(PRInt32 domain, PRInt32 type, PRInt32 proto)
fd = pt_SetMethods(osfd, ftype, PR_FALSE, PR_FALSE);
if (fd == NULL) close(osfd);
}
#ifdef _PR_STRICT_ADDR_LEN
if (fd != NULL) fd->secret->af = domain;
#endif
#if defined(_PR_INET6_PROBE) || !defined(_PR_INET6)
if (fd != NULL) {
/*
@ -4369,6 +4384,9 @@ PR_IMPLEMENT(PRFileDesc*) PR_ImportTCPSocket(PRInt32 osfd)
if (!_pr_initialized) _PR_ImplicitInitialization();
fd = pt_SetMethods(osfd, PR_DESC_SOCKET_TCP, PR_FALSE, PR_TRUE);
if (NULL == fd) close(osfd);
#ifdef _PR_STRICT_ADDR_LEN
if (NULL != fd) fd->secret->af = PF_INET;
#endif
return fd;
} /* PR_ImportTCPSocket */