svn commit: r211030 - head/sys/kern

Michael Tuexen tuexen at FreeBSD.org
Sat Aug 7 17:57:59 UTC 2010


Author: tuexen
Date: Sat Aug  7 17:57:58 2010
New Revision: 211030
URL: http://svn.freebsd.org/changeset/base/211030

Log:
  Fix a bug where MSG_TRUNC was not returned in all necessary cases for
  SOCK_DGRAM socket. MSG_TRUNC was only returned when some mbufs could
  not be copied to the application. If some data was left in the last
  mbuf, it was correctly discarded, but MSG_TRUNC was not set.
  
  Reviewed by: bz
  MFC after: 3 weeks

Modified:
  head/sys/kern/uipc_socket.c

Modified: head/sys/kern/uipc_socket.c
==============================================================================
--- head/sys/kern/uipc_socket.c	Sat Aug  7 17:39:22 2010	(r211029)
+++ head/sys/kern/uipc_socket.c	Sat Aug  7 17:57:58 2010	(r211030)
@@ -2236,7 +2236,12 @@ soreceive_dgram(struct socket *so, struc
 			m_freem(m);
 			return (error);
 		}
-		m = m_free(m);
+		if (len == m->m_len)
+			m = m_free(m);
+		else {
+			m->m_data += len;
+			m->m_len -= len;
+		}
 	}
 	if (m != NULL)
 		flags |= MSG_TRUNC;


More information about the svn-src-all mailing list