- Add graphviz-getaddrinfo.patch to use getaddrinfo instead of

gethostbyname.

OBS-URL: https://build.opensuse.org/package/show/graphics/graphviz?expand=0&rev=71
This commit is contained in:
Philipp Thomas 2013-10-30 12:23:06 +00:00 committed by Git OBS Bridge
parent c0eac2ac7c
commit 920870374d
3 changed files with 78 additions and 0 deletions

View File

@ -0,0 +1,67 @@
---
cmd/lefty/os/unix/io.c | 43 +++++++++++++++++++++++++++++++------------
1 file changed, 31 insertions(+), 12 deletions(-)
Index: cmd/lefty/os/unix/io.c
===================================================================
--- cmd/lefty/os/unix/io.c.orig 2013-09-07 03:07:52.000000000 +0200
+++ cmd/lefty/os/unix/io.c 2013-10-29 18:18:55.989590810 +0100
@@ -285,27 +285,46 @@ int IOwriteline (int ioi, char *bufp) {
static FILE *serverconnect (char *name) {
char *host, *portp, buf[1024];
- int port;
- struct hostent *hp;
- struct sockaddr_in sin;
int cfd;
+ struct addrinfo hints;
+ struct addrinfo *result, *rp;
+
+ memset(&hints, 0, sizeof(struct addrinfo));
+
+ hints.ai_family = AF_UNSPEC; /* Allow IPv4 or IPv6 */
+ hints.ai_socktype = SOCK_STREAM;/* Stream socket */
+ hints.ai_flags = AI_PASSIVE; /* For wildcard IP address */
+ hints.ai_protocol = 0; /* Any protocol */
+ hints.ai_canonname = NULL;
+ hints.ai_addr = NULL;
+ hints.ai_next = NULL;
strcpy (buf, name);
host = buf + 9;
portp = strchr (host, '/');
+
if (*host == 0 || !portp)
return NULL;
- *portp++ = 0, port = atoi (portp);
- if (!(hp = gethostbyname (host)))
- return NULL;
- memset ((char *) &sin, 1, sizeof (sin));
- memcpy ((char *) &sin.sin_addr, hp->h_addr, hp->h_length);
- sin.sin_family = hp->h_addrtype;
- sin.sin_port = htons (port);
- if ((cfd = socket (hp->h_addrtype, SOCK_STREAM, 0)) < 0)
+
+ *portp++ = 0;
+
+ if (!(cfd = getaddrinfo(host, portp, &hints, &result)))
return NULL;
- if (connect (cfd, (struct sockaddr *) &sin, sizeof (sin)) < 0)
+
+ for (rp = result; rp != NULL; rp = rp->ai_next) {
+ cfd = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol);
+
+ if (cfd == -1)
+ continue;
+ if (connect(cfd, rp->ai_addr, rp->ai_addrlen) != -1)
+ break; /* Success */
+ }
+
+ freeaddrinfo(result);
+
+ if (cfd < 0 || rp == NULL)
return NULL;
+
return fdopen (cfd, "w+");
}

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Tue Oct 29 12:22:26 CET 2013 - pth@suse.de
- Add graphviz-getaddrinfo.patch to use getaddrinfo instead of
gethostbyname.
-------------------------------------------------------------------
Wed Oct 23 12:30:42 CEST 2013 - pth@suse.de

View File

@ -33,6 +33,10 @@ Patch2: graphviz-fix-pkgIndex.patch
Patch3: graphviz-no_strict_aliasing.patch
#PATCH-FIX-UPSTREAM print can only be called as function in python3
Patch4: graphviz-python3_version.patch
#PATCH-FIX-UPSTREAM Use getaddrinfo instead of gethostbyname
# This got accepted upstream so it can be removed on the next
# release.
Patch5: graphviz-getaddrinfo.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: bison
@ -92,6 +96,7 @@ Note: If you need output in png format you also need to install
%patch2
%patch3
%patch4 -p1
%patch5
# Fix path in generated man pages
sed -e 's$@LIB_DIR@$%{_libdir}$g' tclpkg/gv/gv_doc_langs.tcl >tclpkg/gv/gv_doc_langs.tcl.new && mv tclpkg/gv/gv_doc_langs.tcl.new tclpkg/gv/gv_doc_langs.tcl