Unbreak by using socklen_t as needed.

This commit is contained in:
Bill Fenner 2006-12-04 03:12:19 +00:00
parent 1fa49fe8c5
commit 81e2c16875
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=178794
6 changed files with 58 additions and 22 deletions

View File

@ -34,10 +34,6 @@ PLIST_FILES= bin/vat
.include <bsd.port.pre.mk>
.if ${OSVERSION} >= 501000
BROKEN= Does not compile on FreeBSD > 5.0
.endif
post-install:
${STRIP_CMD} ${PREFIX}/bin/vat

View File

@ -1,6 +1,6 @@
--- net.cc.orig 1997/10/07 19:07:01
+++ net.cc 1998/01/26 22:21:41
@@ -163,46 +163,48 @@
--- net.cc.orig Thu Mar 21 03:49:18 1996
+++ net.cc Sun Dec 3 19:04:01 2006
@@ -163,46 +163,49 @@
{
int cc = ::send(fd, (char*)buf, len, 0);
if (cc < 0) {
@ -39,7 +39,8 @@
+ * }
+ *
+ */
+ int err, errlen = sizeof(err), savederrno;
+ int err, savederrno;
+ socklen_t errlen = sizeof(err);
+
+ savederrno = errno;
+ getsockopt(fd, SOL_SOCKET, SO_ERROR, &err,
@ -87,7 +88,7 @@
break;
case ENETUNREACH:
@@ -217,7 +219,7 @@
@@ -217,7 +220,7 @@
* icmp unreachable, so we should be able to
* send now.
*/
@ -96,12 +97,13 @@
break;
default:
@@ -264,12 +266,14 @@
@@ -264,12 +267,15 @@
}
int cc = ::sendmsg(ssock_, (msghdr*)&mh, 0);
if (cc < 0) {
- switch (errno) {
+ int err, errlen = sizeof(err), savederrno;
+ int err, savederrno;
+ socklen_t errlen = sizeof(err);
+
+ savederrno = errno;
+ getsockopt(ssock_, SOL_SOCKET, SO_ERROR, &err,
@ -115,3 +117,12 @@
break;
case ENETUNREACH:
@@ -297,7 +303,7 @@
int Network::dorecv(u_char* buf, int len, u_int32_t& from, int fd)
{
sockaddr_in sfrom;
- int fromlen = sizeof(sfrom);
+ socklen_t fromlen = sizeof(sfrom);
int cc = ::recvfrom(fd, (char*)buf, len, 0,
(sockaddr*)&sfrom, &fromlen);
if (cc < 0) {

11
audio/vat/files/patch-ap Normal file
View File

@ -0,0 +1,11 @@
--- net-ip.cc.orig Thu May 16 05:28:06 1996
+++ net-ip.cc Sun Dec 3 19:04:50 2006
@@ -203,7 +203,7 @@
{
memset((char *)p, 0, sizeof(*p));
p->sin_family = AF_INET;
- int len = sizeof(*p);
+ socklen_t len = sizeof(*p);
if (getsockname(ssock_, (struct sockaddr *)p, &len) < 0) {
perror("getsockname");
p->sin_addr.s_addr = 0;

View File

@ -34,10 +34,6 @@ PLIST_FILES= bin/vat
.include <bsd.port.pre.mk>
.if ${OSVERSION} >= 501000
BROKEN= Does not compile on FreeBSD > 5.0
.endif
post-install:
${STRIP_CMD} ${PREFIX}/bin/vat

View File

@ -1,6 +1,6 @@
--- net.cc.orig 1997/10/07 19:07:01
+++ net.cc 1998/01/26 22:21:41
@@ -163,46 +163,48 @@
--- net.cc.orig Thu Mar 21 03:49:18 1996
+++ net.cc Sun Dec 3 19:04:01 2006
@@ -163,46 +163,49 @@
{
int cc = ::send(fd, (char*)buf, len, 0);
if (cc < 0) {
@ -39,7 +39,8 @@
+ * }
+ *
+ */
+ int err, errlen = sizeof(err), savederrno;
+ int err, savederrno;
+ socklen_t errlen = sizeof(err);
+
+ savederrno = errno;
+ getsockopt(fd, SOL_SOCKET, SO_ERROR, &err,
@ -87,7 +88,7 @@
break;
case ENETUNREACH:
@@ -217,7 +219,7 @@
@@ -217,7 +220,7 @@
* icmp unreachable, so we should be able to
* send now.
*/
@ -96,12 +97,13 @@
break;
default:
@@ -264,12 +266,14 @@
@@ -264,12 +267,15 @@
}
int cc = ::sendmsg(ssock_, (msghdr*)&mh, 0);
if (cc < 0) {
- switch (errno) {
+ int err, errlen = sizeof(err), savederrno;
+ int err, savederrno;
+ socklen_t errlen = sizeof(err);
+
+ savederrno = errno;
+ getsockopt(ssock_, SOL_SOCKET, SO_ERROR, &err,
@ -115,3 +117,12 @@
break;
case ENETUNREACH:
@@ -297,7 +303,7 @@
int Network::dorecv(u_char* buf, int len, u_int32_t& from, int fd)
{
sockaddr_in sfrom;
- int fromlen = sizeof(sfrom);
+ socklen_t fromlen = sizeof(sfrom);
int cc = ::recvfrom(fd, (char*)buf, len, 0,
(sockaddr*)&sfrom, &fromlen);
if (cc < 0) {

11
mbone/vat/files/patch-ap Normal file
View File

@ -0,0 +1,11 @@
--- net-ip.cc.orig Thu May 16 05:28:06 1996
+++ net-ip.cc Sun Dec 3 19:04:50 2006
@@ -203,7 +203,7 @@
{
memset((char *)p, 0, sizeof(*p));
p->sin_family = AF_INET;
- int len = sizeof(*p);
+ socklen_t len = sizeof(*p);
if (getsockname(ssock_, (struct sockaddr *)p, &len) < 0) {
perror("getsockname");
p->sin_addr.s_addr = 0;