зеркало из https://github.com/mozilla/pjs.git
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:
Родитель
a439879c74
Коммит
5d776923e8
|
@ -97,6 +97,7 @@ struct ip_mreq {
|
||||||
#define _PR_USE_POLL
|
#define _PR_USE_POLL
|
||||||
#define _PR_STAT_HAS_ONLY_ST_ATIME
|
#define _PR_STAT_HAS_ONLY_ST_ATIME
|
||||||
#define _PR_NO_LARGE_FILES
|
#define _PR_NO_LARGE_FILES
|
||||||
|
#define _PR_STRICT_ADDR_LEN
|
||||||
|
|
||||||
/* IPv6 support */
|
/* IPv6 support */
|
||||||
#ifdef _SOCKADDR_LEN
|
#ifdef _SOCKADDR_LEN
|
||||||
|
|
|
@ -1714,6 +1714,13 @@ struct PRFilePrivate {
|
||||||
#endif
|
#endif
|
||||||
#if !defined(XP_UNIX) /* BugZilla: 4090 */
|
#if !defined(XP_UNIX) /* BugZilla: 4090 */
|
||||||
PRBool appendMode;
|
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
|
#endif
|
||||||
_MDFileDesc md;
|
_MDFileDesc md;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1628,6 +1628,18 @@ static PRFileDesc* pt_Accept(
|
||||||
|
|
||||||
if (pt_TestAbort()) return newfd;
|
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);
|
osfd = accept(fd->secret->md.osfd, (struct sockaddr*)addr, &addr_len);
|
||||||
syserrno = errno;
|
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);
|
fd = pt_SetMethods(osfd, ftype, PR_FALSE, PR_FALSE);
|
||||||
if (fd == NULL) close(osfd);
|
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 defined(_PR_INET6_PROBE) || !defined(_PR_INET6)
|
||||||
if (fd != NULL) {
|
if (fd != NULL) {
|
||||||
/*
|
/*
|
||||||
|
@ -4369,6 +4384,9 @@ PR_IMPLEMENT(PRFileDesc*) PR_ImportTCPSocket(PRInt32 osfd)
|
||||||
if (!_pr_initialized) _PR_ImplicitInitialization();
|
if (!_pr_initialized) _PR_ImplicitInitialization();
|
||||||
fd = pt_SetMethods(osfd, PR_DESC_SOCKET_TCP, PR_FALSE, PR_TRUE);
|
fd = pt_SetMethods(osfd, PR_DESC_SOCKET_TCP, PR_FALSE, PR_TRUE);
|
||||||
if (NULL == fd) close(osfd);
|
if (NULL == fd) close(osfd);
|
||||||
|
#ifdef _PR_STRICT_ADDR_LEN
|
||||||
|
if (NULL != fd) fd->secret->af = PF_INET;
|
||||||
|
#endif
|
||||||
return fd;
|
return fd;
|
||||||
} /* PR_ImportTCPSocket */
|
} /* PR_ImportTCPSocket */
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче