Teach m_copyback() to use trailing space of the last mbuf in chain.
This commit is contained in:
parent
e4651e0595
commit
129c5c814d
|
@ -1271,6 +1271,10 @@ m_copyback(struct mbuf *m0, int off, int len, c_caddr_t cp)
|
|||
m = m->m_next;
|
||||
}
|
||||
while (len > 0) {
|
||||
if (m->m_next == NULL && (len > m->m_len - off)) {
|
||||
m->m_len += min(len - (m->m_len - off),
|
||||
M_TRAILINGSPACE(m));
|
||||
}
|
||||
mlen = min (m->m_len - off, len);
|
||||
bcopy(cp, off + mtod(m, caddr_t), (u_int)mlen);
|
||||
cp += mlen;
|
||||
|
|
Loading…
Reference in New Issue