ports/144575: port fix: x11-toolkits/plib - Fix netSocket code
Ganael Laplanche
ganael.laplanche at martymac.com
Tue Mar 9 12:40:02 UTC 2010
>Number: 144575
>Category: ports
>Synopsis: port fix: x11-toolkits/plib - Fix netSocket code
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Tue Mar 09 12:40:02 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator: Ganael Laplanche
>Release: 9.0-CURRENT
>Organization:
http://contribs.martymac.org
>Environment:
FreeBSD laptop.martymac.com 9.0-CURRENT FreeBSD 9.0-CURRENT #6: Thu Jan 21 14:46:32 UTC 2010 martymac at laptop.martymac.com:/usr/obj/usr/src/sys/GENERIC i386
>Description:
This patch fixes socket handling for netSocket class in plib.
As written in src/net/netSocket.h :
/* DANGER!!! This MUST match 'struct sockaddr_in' exactly! */
the netAddress class should begin with the contents of 'struct sockaddr_in' *exactly*, because casts are performed using pointers. E.g. in src/net/netSocket.cxx :
int netSocket::connect ( const char* host, int port )
{
[...]
netAddress addr ( host, port ) ;
[...]
return ::connect(handle,(const sockaddr*)&addr,sizeof(netAddress));
}
This patch should fix any network-related application using the plib library (e.g. simgear). It closes ports/138786.
As this lib is built as static, we should also bump PORTREVISIONs for dependent apps to make them update properly.
>How-To-Repeat:
>Fix:
Patch attached with submission follows:
diff -aurN plib.orig/Makefile plib/Makefile
--- plib.orig/Makefile 2010-03-09 08:12:50.731527610 +0000
+++ plib/Makefile 2010-03-09 08:33:59.434649375 +0000
@@ -7,7 +7,7 @@
PORTNAME= plib
PORTVERSION= 1.8.5
-PORTREVISION= 2
+PORTREVISION= 3
CATEGORIES= x11-toolkits
MASTER_SITES= http://plib.sourceforge.net/dist/
diff -aurN plib.orig/files/patch-src-net-netSocket.h plib/files/patch-src-net-netSocket.h
--- plib.orig/files/patch-src-net-netSocket.h 1970-01-01 00:00:00.000000000 +0000
+++ plib/files/patch-src-net-netSocket.h 2010-03-09 10:27:48.968986979 +0000
@@ -0,0 +1,27 @@
+--- src/net/netSocket.h.orig 2008-03-11 02:06:20.000000000 +0000
++++ src/net/netSocket.h 2010-03-09 10:27:29.331029501 +0000
+@@ -41,6 +41,8 @@
+ #define NET_SOCKET_H
+
+ #include "ul.h"
++#include <sys/types.h>
++#include <sys/socket.h>
+ #include <errno.h>
+
+ /*
+@@ -49,10 +51,11 @@
+ class netAddress
+ {
+ /* DANGER!!! This MUST match 'struct sockaddr_in' exactly! */
+- short sin_family ;
+- unsigned short sin_port ;
+- unsigned int sin_addr ;
+- char sin_zero [ 8 ] ;
++ int8_t sin_len;
++ sa_family_t sin_family;
++ in_port_t sin_port;
++ uint32_t sin_addr;
++ char sin_zero[8];
+
+ public:
+ netAddress () {}
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list