svn commit: r195200 - in head/usr.sbin: . wake

Brian Somers brian at Awfulhak.org
Wed Jul 1 07:25:30 UTC 2009


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

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

-- 
Brian Somers                                          <brian at Awfulhak.org>
Don't _EVER_ lose your sense of humour !               <brian at FreeBSD.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 306 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20090701/e8623adc/signature.pgp


More information about the svn-src-head mailing list