patch-2.0.7 linux/net/socket.c

Next file: linux/Documentation/Changes
Previous file: linux/kernel/sys.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.0.6/linux/net/socket.c linux/net/socket.c
@@ -944,17 +944,22 @@
 	err=verify_area(VERIFY_READ,buff,len);
 	if(err)
 	  	return err;
-  	
-	if((err=move_addr_to_kernel(addr,addr_len,address))<0)
-	  	return err;
-	  	
+
 	iov.iov_base=buff;
 	iov.iov_len=len;
-	msg.msg_name=address;
-	msg.msg_namelen=addr_len;
+	msg.msg_name = NULL;
+	msg.msg_namelen = 0;
 	msg.msg_iov=&iov;
 	msg.msg_iovlen=1;
 	msg.msg_control=NULL;
+	if (addr && addr_len) {
+		err=move_addr_to_kernel(addr,addr_len,address);
+		if (err < 0)
+			return err;
+		msg.msg_name=address;
+		msg.msg_namelen=addr_len;
+	}
+	  	
 	return(sock->ops->sendmsg(sock, &msg, len, (file->f_flags & O_NONBLOCK),
 		flags));
 }


FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov