Explorar o código

[nfs] : fix bug in nfs when enable ipv6

SummerGift %!s(int64=8) %!d(string=hai) anos
pai
achega
98d8145661
Modificáronse 1 ficheiros con 9 adicións e 1 borrados
  1. 9 1
      components/dfs/filesystems/nfs/rpc/clnt_generic.c

+ 9 - 1
components/dfs/filesystems/nfs/rpc/clnt_generic.c

@@ -62,7 +62,15 @@ CLIENT *clnt_create (const char *hostname, const unsigned long prog,
 	memset((char*)&sin,0,sizeof(sin));
 	memset((char*)&sin,0,sizeof(sin));
 	sin.sin_family = h->h_addrtype;
 	sin.sin_family = h->h_addrtype;
 	sin.sin_port = 0;
 	sin.sin_port = 0;
-	memmove((char *) &sin.sin_addr, h->h_addr, h->h_length);
+	
+	if (h->h_addrtype == AF_INET)
+	{
+		memmove((char *) &sin.sin_addr, h->h_addr, sizeof(sin.sin_addr)); 
+	}
+	else
+	{
+		return NULL;
+	}
 
 
 	sock = -1;
 	sock = -1;
 	if (strcmp(proto, "udp") == 0)
 	if (strcmp(proto, "udp") == 0)