On Wed, 1 Jul 2009 01:45:53 +0400 Stanislav Sedov <s...@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                                          <br...@awfulhak.org>
Don't _EVER_ lose your sense of humour !               <br...@freebsd.org>

Attachment: signature.asc
Description: PGP signature

Reply via email to