Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Jun 2009 23:56:24 -0700
From:      Brian Somers <brian@Awfulhak.org>
To:        Stanislav Sedov <stas@FreeBSD.org>
Cc:        svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, Martin Blapp <mbr@FreeBSD.org>, Marc Balmer <marc@msys.ch>, src-committers@FreeBSD.org
Subject:   Re: svn commit: r195200 - in head/usr.sbin: . wake
Message-ID:  <20090630235624.13a526dc@dev.lan.Awfulhak.org>
In-Reply-To: <20090701014553.32117b64.stas@FreeBSD.org>
References:  <200906301851.n5UIpNJQ089171@svn.freebsd.org> <20090701014553.32117b64.stas@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
--Sig_/_Mbuao.zX.sOdKlwNnjU7um
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

On Wed, 1 Jul 2009 01:45:53 +0400 Stanislav Sedov <stas@FreeBSD.org> wrote:
> > +	p =3D (u_char *)&pkt;
> > +	len =3D sizeof(pkt);
> > +	bw =3D 0;
> > +	while (len) {
> > +		if ((bw =3D write(bpf, &pkt, sizeof(pkt))) =3D=3D -1)
> > +			return -1;
> > +		len -=3D bw;
> > +		p +=3D bw;
> > +	}
> > +	return 0;
> > +}
>=20
> What the "p" pointer is used here for?  I don't see any usage for it besi=
des
> incrementing it in the loop.  Am I missing something?

The write() has two bugs.  It should be write(bpf, p, len).

--=20
Brian Somers                                          <brian@Awfulhak.org>
Don't _EVER_ lose your sense of humour !               <brian@FreeBSD.org>

--Sig_/_Mbuao.zX.sOdKlwNnjU7um
Content-Type: application/pgp-signature; name=signature.asc
Content-Disposition: attachment; filename=signature.asc

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.12 (FreeBSD)

iQCVAwUBSksIpw7tvOdmanQhAQLTwwQAr74bKV9Ebbp4kJf2u9ZPnB5c5v0xKo65
A9w5AFgrvyjhJQibHuKrB2S5GCotk5M8y26Mwkwms7Ns8H3DKDus9xPYJygkas7V
qhGGO6P/CWayDBK1gxS+wXDNQTZ6XYjcehP2z2wW4Mj8SnqdciCb4sjH0CJNxiqS
xFxExqtQH0I=
=+zw0
-----END PGP SIGNATURE-----

--Sig_/_Mbuao.zX.sOdKlwNnjU7um--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090630235624.13a526dc>