- 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
This commit is contained in:
Marcus Schaefer 2011-04-04 15:30:59 +00:00 committed by Git OBS Bridge
parent 5bca205674
commit a979ba7b53
3 changed files with 50 additions and 0 deletions

42
nbd-2.9.20-bigendian.diff Normal file
View File

@ -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);
}

View File

@ -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

View File

@ -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"