diff options
author | Bret Lambert <blambert@cvs.openbsd.org> | 2011-04-04 20:25:36 +0000 |
---|---|---|
committer | Bret Lambert <blambert@cvs.openbsd.org> | 2011-04-04 20:25:36 +0000 |
commit | e44f837ee6acb61bad440134e7b882c18e3e9d8c (patch) | |
tree | 102f354cf330b67f9ebdf4aca27ad3fa971de7bf /sys | |
parent | 484e3d150f72df18de59d739cdca20f5aa2f2145 (diff) |
m_copyback is no longer a void function, so start using its error return
instead of coming at it sideways to detect failure.
ok claudio@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/net/rtsock.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index 7d1dd8dc312..52b6ae53835 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtsock.c,v 1.116 2011/04/03 17:01:23 jsing Exp $ */ +/* $OpenBSD: rtsock.c,v 1.117 2011/04/04 20:25:35 blambert Exp $ */ /* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */ /* @@ -900,8 +900,7 @@ fail: if (rp) rp->rcb_proto.sp_family = 0; /* Avoid us */ if (rtm) { - m_copyback(m, 0, rtm->rtm_msglen, rtm, M_NOWAIT); - if (m->m_pkthdr.len < rtm->rtm_msglen) { + if (m_copyback(m, 0, rtm->rtm_msglen, rtm, M_NOWAIT)) { m_freem(m); m = NULL; } else if (m->m_pkthdr.len > rtm->rtm_msglen) @@ -1000,13 +999,12 @@ rt_msg1(int type, struct rt_addrinfo *rtinfo) continue; rtinfo->rti_addrs |= (1 << i); dlen = ROUNDUP(sa->sa_len); - m_copyback(m, len, dlen, sa, M_NOWAIT); + if (m_copyback(m, len, dlen, sa, M_NOWAIT)) { + m_freem(m); + return (NULL); + } len += dlen; } - if (m->m_pkthdr.len != len) { - m_freem(m); - return (NULL); - } rtm->rtm_msglen = len; rtm->rtm_hdrlen = hlen; rtm->rtm_version = RTM_VERSION; |