summaryrefslogtreecommitdiffstats
path: root/sys/net/if_tap.c
diff options
context:
space:
mode:
authorcsjp <csjp@FreeBSD.org>2006-11-04 20:54:37 +0000
committercsjp <csjp@FreeBSD.org>2006-11-04 20:54:37 +0000
commitca30d69fda30d846074cf41aba30e036b5e06f78 (patch)
treef648f9a15e9fd8e990de8044fe4d56ec80cf3282 /sys/net/if_tap.c
parent7d77b4e35faa299425c10e8671a8b46bb9cf26ae (diff)
downloadFreeBSD-src-ca30d69fda30d846074cf41aba30e036b5e06f78.zip
FreeBSD-src-ca30d69fda30d846074cf41aba30e036b5e06f78.tar.gz
Currently, we initialize "error" to zero when it's declared, then
we never initialize it to anything else. However, in the case that m_uiotombuf fails, we return error (effectively reporting success). This appears to be a relic of an older revision of this file, where "error" used to be doing something useful. (See revision 1.1, where error is used in a loop with uiomove() instead of using m_uiotomubf). So instead on unconditionally reporting success in the case there is a failure in m_uiotombuf, explicitly return ENOBUFS. While we are here, garbage collect the error variable since it's no longer required. MFC after: 2 weeks
Diffstat (limited to 'sys/net/if_tap.c')
-rw-r--r--sys/net/if_tap.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/sys/net/if_tap.c b/sys/net/if_tap.c
index 930aa72..05b39d0 100644
--- a/sys/net/if_tap.c
+++ b/sys/net/if_tap.c
@@ -812,7 +812,6 @@ tapwrite(struct cdev *dev, struct uio *uio, int flag)
struct tap_softc *tp = dev->si_drv1;
struct ifnet *ifp = tp->tap_ifp;
struct mbuf *m;
- int error = 0;
TAPDEBUG("%s writting, minor = %#x\n",
ifp->if_xname, minor(dev));
@@ -830,7 +829,7 @@ tapwrite(struct cdev *dev, struct uio *uio, int flag)
if ((m = m_uiotombuf(uio, M_DONTWAIT, 0, ETHER_ALIGN,
M_PKTHDR)) == NULL) {
ifp->if_ierrors ++;
- return (error);
+ return (ENOBUFS);
}
m->m_pkthdr.rcvif = ifp;
OpenPOWER on IntegriCloud