-/* $OpenBSD: uipc_socket2.c,v 1.137 2023/07/04 22:28:24 mvs Exp $ */
+/* $OpenBSD: uipc_socket2.c,v 1.138 2023/10/30 13:27:53 bluhm Exp $ */
/* $NetBSD: uipc_socket2.c,v 1.11 1996/02/04 02:17:55 christos Exp $ */
/*
struct mbuf *control)
{
struct mbuf *m, *mlast, *n;
- int space = 0;
+ int eor = 0, space = 0;
if (control == NULL)
panic("sbappendcontrol");
break;
}
n = m; /* save pointer to last control buffer */
- for (m = m0; m; m = m->m_next)
+ for (m = m0; m; m = m->m_next) {
space += m->m_len;
+ eor |= m->m_flags & M_EOR;
+ if (eor) {
+ if (m->m_next == NULL)
+ m->m_flags |= M_EOR;
+ else
+ m->m_flags &= ~M_EOR;
+ }
+ }
if (space > sbspace(so, sb))
return (0);
n->m_next = m0; /* concatenate data to control */