From 7b9754ed1f460f51c9aebe901f427423ce7ad45d Mon Sep 17 00:00:00 2001 From: Bruce Evans Date: Sun, 27 Nov 1994 15:29:57 +0000 Subject: [PATCH] Fix previous change: don't attempt to reserve cblocks if the tty is null. --- sys/net/if_ppp.c | 13 ++++++++----- sys/net/if_sl.c | 13 ++++++++----- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/sys/net/if_ppp.c b/sys/net/if_ppp.c index 826bcc60a4a8..3f4ca74c576a 100644 --- a/sys/net/if_ppp.c +++ b/sys/net/if_ppp.c @@ -69,7 +69,7 @@ * Paul Mackerras (paulus@cs.anu.edu.au). */ -/* $Id: if_ppp.c,v 1.7 1994/11/23 08:29:44 ugen Exp $ */ +/* $Id: if_ppp.c,v 1.8 1994/11/26 19:23:59 bde Exp $ */ /* from if_sl.c,v 1.11 84/10/04 12:54:47 rick Exp */ #include "ppp.h" @@ -1506,11 +1506,14 @@ pppioctl(ifp, cmd, data) if (error = suser(p->p_ucred, &p->p_acflag)) return (error); if (ifr->ifr_mtu > PPP_MAXMTU) - error = EINVAL; + error = EINVAL; else { - sc->sc_if.if_mtu = ifr->ifr_mtu; - clist_alloc_cblocks(&((struct tty *) sc->sc_devp)->t_outq, - sc->sc_if.if_mtu + PPP_HIWAT, + struct tty *tp; + + sc->sc_if.if_mtu = ifr->ifr_mtu; + tp = (struct tty *) sc->sc_devp; + if (tp != NULL) + clist_alloc_cblocks(&tp->t_outq, sc->sc_if.if_mtu + PPP_HIWAT, sc->sc_if.if_mtu + PPP_HIWAT); } break; diff --git a/sys/net/if_sl.c b/sys/net/if_sl.c index 915bc4b077ac..281228466ba3 100644 --- a/sys/net/if_sl.c +++ b/sys/net/if_sl.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)if_sl.c 8.6 (Berkeley) 2/1/94 - * $Id: if_sl.c,v 1.9 1994/10/08 01:40:22 phk Exp $ + * $Id: if_sl.c,v 1.10 1994/11/26 19:24:00 bde Exp $ */ /* @@ -883,11 +883,14 @@ slioctl(ifp, cmd, data) if (ifr->ifr_mtu > SLTMAX) error = EINVAL; else { + struct tty *tp; + ifp->if_mtu = ifr->ifr_mtu; - clist_alloc_cblocks( - &sl_softc[ifp->if_unit].sc_ttyp->t_outq, - ifp->if_mtu + SLIP_HIWAT, - ifp->if_mtu + SLIP_HIWAT); + tp = sl_softc[ifp->if_unit].sc_ttyp; + if (tp != NULL) + clist_alloc_cblocks(&tp->t_outq, + ifp->if_mtu + SLIP_HIWAT, + ifp->if_mtu + SLIP_HIWAT); } break;