hasufell 14/05/23 17:47:52 Added: 02-libuv-0.11.25-tests.patch 01-libuv-0.11.25-tests.patch Log: fix tests wrt #510110 (Portage version: 2.2.10/cvs/Linux x86_64, signed Manifest commit with key BDEED020)
Revision Changes Path 1.1 dev-libs/libuv/files/02-libuv-0.11.25-tests.patch file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-libs/libuv/files/02-libuv-0.11.25-tests.patch?rev=1.1&view=markup plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-libs/libuv/files/02-libuv-0.11.25-tests.patch?rev=1.1&content-type=text/plain Index: 02-libuv-0.11.25-tests.patch =================================================================== >From 02c2595fdc259fa15b9a927779cbe65f381f4b26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= <sag...@gmail.com> Date: Fri, 23 May 2014 16:36:57 +0200 Subject: [PATCH] unix, windows: define UV__INET/6_ADDRSTRLEN constants --- src/inet.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/inet.c b/src/inet.c index 9220de6..0eb9438 100644 --- a/src/inet.c +++ b/src/inet.c @@ -27,6 +27,9 @@ #include "uv.h" #include "uv-common.h" +#define UV__INET_ADDRSTRLEN 16 +#define UV__INET6_ADDRSTRLEN 46 + static int inet_ntop4(const unsigned char *src, char *dst, size_t size); static int inet_ntop6(const unsigned char *src, char *dst, size_t size); @@ -49,7 +52,7 @@ int uv_inet_ntop(int af, const void* src, char* dst, size_t size) { static int inet_ntop4(const unsigned char *src, char *dst, size_t size) { static const char fmt[] = "%u.%u.%u.%u"; - char tmp[sizeof "255.255.255.255"]; + char tmp[UV__INET_ADDRSTRLEN]; int l; #ifndef _WIN32 @@ -74,7 +77,7 @@ static int inet_ntop6(const unsigned char *src, char *dst, size_t size) { * Keep this in mind if you think this function should have been coded * to use pointer overlays. All the world's not a VAX. */ - char tmp[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"], *tp; + char tmp[UV__INET6_ADDRSTRLEN], *tp; struct { int base, len; } best, cur; unsigned int words[sizeof(struct in6_addr) / sizeof(uint16_t)]; int i; -- 1.9.3 1.1 dev-libs/libuv/files/01-libuv-0.11.25-tests.patch file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-libs/libuv/files/01-libuv-0.11.25-tests.patch?rev=1.1&view=markup plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-libs/libuv/files/01-libuv-0.11.25-tests.patch?rev=1.1&content-type=text/plain Index: 01-libuv-0.11.25-tests.patch =================================================================== >From f58b02f2cf068e1bed10bf9f632bad396d907de9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= <sag...@gmail.com> Date: Fri, 23 May 2014 09:25:23 +0200 Subject: [PATCH] unix, windows: fix parsing scoped IPv6 addresses --- src/inet.c | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/src/inet.c b/src/inet.c index 0eb9438..36457f4 100644 --- a/src/inet.c +++ b/src/inet.c @@ -17,6 +17,7 @@ #include <stdio.h> #include <string.h> +#include <stdlib.h> #if defined(_MSC_VER) && _MSC_VER < 1600 # include "stdint-msvc2008.h" @@ -159,11 +160,27 @@ static int inet_ntop6(const unsigned char *src, char *dst, size_t size) { int uv_inet_pton(int af, const char* src, void* dst) { + if (src == NULL || dst == NULL) + return UV_EINVAL; + switch (af) { case AF_INET: return (inet_pton4(src, dst)); - case AF_INET6: - return (inet_pton6(src, dst)); + case AF_INET6: { + int len; + char tmp[UV__INET6_ADDRSTRLEN], *s, *p; + s = (char*) src; + p = strchr(src, '%'); + if (p != NULL) { + s = tmp; + len = p - src; + if (len > UV__INET6_ADDRSTRLEN-1) + len = UV__INET6_ADDRSTRLEN-1; + memcpy(s, src, len); + s[len] = '\0'; + } + return inet_pton6(s, dst); + } default: return UV_EAFNOSUPPORT; } @@ -228,7 +245,7 @@ static int inet_pton6(const char *src, unsigned char *dst) { curtok = src; seen_xdigits = 0; val = 0; - while ((ch = *src++) != '\0' && ch != '%') { + while ((ch = *src++) != '\0') { const char *pch; if ((pch = strchr((xdigits = xdigits_l), ch)) == NULL) @@ -259,19 +276,7 @@ static int inet_pton6(const char *src, unsigned char *dst) { continue; } if (ch == '.' && ((tp + sizeof(struct in_addr)) <= endp)) { - int err; - - /* Scope id present, parse ipv4 addr without it */ - pch = strchr(curtok, '%'); - if (pch != NULL) { - char tmp[sizeof "255.255.255.255"]; - - memcpy(tmp, curtok, pch - curtok); - curtok = tmp; - src = pch; - } - - err = inet_pton4(curtok, tp); + int err = inet_pton4(curtok, tp); if (err == 0) { tp += sizeof(struct in_addr); seen_xdigits = 0; -- 1.9.3