From a979ba7b53595d13341572aab93429f574bae9f011e0a5308b986d7615c8ed41 Mon Sep 17 00:00:00 2001 From: Marcus Schaefer Date: Mon, 4 Apr 2011 15:30:59 +0000 Subject: [PATCH] - socklen_t is always 32bit, size_t is 64bit. so a classical big endian 64bit error (bnc #674281) OBS-URL: https://build.opensuse.org/package/show/network:utilities/nbd?expand=0&rev=9 --- nbd-2.9.20-bigendian.diff | 42 +++++++++++++++++++++++++++++++++++++++ nbd.changes | 6 ++++++ nbd.spec | 2 ++ 3 files changed, 50 insertions(+) create mode 100644 nbd-2.9.20-bigendian.diff diff --git a/nbd-2.9.20-bigendian.diff b/nbd-2.9.20-bigendian.diff new file mode 100644 index 0000000..e93bae1 --- /dev/null +++ b/nbd-2.9.20-bigendian.diff @@ -0,0 +1,42 @@ +--- nbd-2.9.20/nbd-server.c 2011-01-28 13:34:16.000000000 +0100 ++++ nbd-2.9.20/nbd-server.c 2011-04-04 17:03:04.000000000 +0200 +@@ -1620,7 +1620,7 @@ + struct sockaddr_storage netaddr; + struct sockaddr_in *netaddr4 = NULL; + struct sockaddr_in6 *netaddr6 = NULL; +- size_t addrinlen = sizeof( addrin ); ++ socklen_t addrinlen = sizeof( addrin ); + struct addrinfo hints; + struct addrinfo *ai = NULL; + char peername[NI_MAXHOST]; +@@ -1630,10 +1630,10 @@ + int e; + int shift; + +- if (getpeername(net, (struct sockaddr *) &addrin, (socklen_t *)&addrinlen) < 0) ++ if (getpeername(net, (struct sockaddr *) &addrin, &addrinlen) < 0) + err("getsockname failed: %m"); + +- getnameinfo((struct sockaddr *)&addrin, (socklen_t)addrinlen, ++ getnameinfo((struct sockaddr *)&addrin, addrinlen, + peername, sizeof (peername), NULL, 0, NI_NUMERICHOST); + + memset(&hints, '\0', sizeof (hints)); +@@ -1666,7 +1666,7 @@ + (netaddr4->sin_addr).s_addr>>=32-(client->server->cidrlen); + (netaddr4->sin_addr).s_addr<<=32-(client->server->cidrlen); + +- getnameinfo((struct sockaddr *) netaddr4, (socklen_t) addrinlen, ++ getnameinfo((struct sockaddr *) netaddr4, addrinlen, + netname, sizeof (netname), NULL, 0, NI_NUMERICHOST); + tmp=g_strdup_printf("%s/%s", netname, peername); + }else if(ai->ai_family == AF_INET6) { +@@ -1682,7 +1682,7 @@ + (netaddr6->sin6_addr).s6_addr32[i]>>=shift; + (netaddr6->sin6_addr).s6_addr32[i]<<=shift; + +- getnameinfo((struct sockaddr *)netaddr6, (socklen_t)addrinlen, ++ getnameinfo((struct sockaddr *)netaddr6, addrinlen, + netname, sizeof(netname), NULL, 0, NI_NUMERICHOST); + tmp=g_strdup_printf("%s/%s", netname, peername); + } diff --git a/nbd.changes b/nbd.changes index 64fda37..498e4f8 100644 --- a/nbd.changes +++ b/nbd.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Mon Apr 4 17:30:17 CEST 2011 - ms@suse.de + +- socklen_t is always 32bit, size_t is 64bit. so a classical + big endian 64bit error (bnc #674281) + ------------------------------------------------------------------- Fri Feb 25 12:40:16 CET 2011 - ms@suse.de diff --git a/nbd.spec b/nbd.spec index bf212c9..6e0cca1 100644 --- a/nbd.spec +++ b/nbd.spec @@ -29,6 +29,7 @@ AutoReqProv: on Source: %{name}-%{version}.tar.bz2 Source2: init.nbd-server Patch2: nbd-2.9.20-close.diff +Patch3: nbd-2.9.20-bigendian.diff Summary: Network Block Device Server and Client Utilities Url: http://nbd.sourceforge.net/ Prefix: /usr @@ -95,6 +96,7 @@ Authors: %prep %setup %patch2 -p1 +%patch3 -p1 %build export CFLAGS="$RPM_OPT_FLAGS -fstack-protector"