diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2015-05-31 20:10:45 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2015-05-31 20:10:45 +0000 |
commit | f0836126cc84d2f224e7f4e95d4cc4613adec8d8 (patch) | |
tree | 23bdb5c4f59f708166d5f9f01f5d895a8d4f3497 /sys/kern/uipc_mbuf.c | |
parent | 6f39b0ff9a313e2af7b93085787d409c1c1453e3 (diff) |
If the first list was empty, ml_join() did not not clear the second
list after transferring all elements away. Reorder the conditionals
to make sure that ml_init() is always called for a non empty second
list. This makes all cases consistent and is less surprising.
OK dlg@
Diffstat (limited to 'sys/kern/uipc_mbuf.c')
-rw-r--r-- | sys/kern/uipc_mbuf.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index 704bc98af1e..a230b8e3bcc 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_mbuf.c,v 1.203 2015/04/13 08:45:48 mpi Exp $ */ +/* $OpenBSD: uipc_mbuf.c,v 1.204 2015/05/31 20:10:44 bluhm Exp $ */ /* $NetBSD: uipc_mbuf.c,v 1.15.4.1 1996/06/13 17:11:44 cgd Exp $ */ /* @@ -1266,10 +1266,11 @@ ml_enqueue(struct mbuf_list *ml, struct mbuf *m) void ml_join(struct mbuf_list *mla, struct mbuf_list *mlb) { - if (mla->ml_tail == NULL) - *mla = *mlb; - else if (mlb->ml_tail != NULL) { - mla->ml_tail->m_nextpkt = mlb->ml_head; + if (!ml_empty(mlb)) { + if (ml_empty(mla)) + mla->ml_head = mlb->ml_head; + else + mla->ml_tail->m_nextpkt = mlb->ml_head; mla->ml_tail = mlb->ml_tail; mla->ml_len += mlb->ml_len; |