* Samuel Thibault (samuel.thiba...@gnu.org) wrote:
> Hello,
> 
> Dr. David Alan Gilbert, le lun. 08 avril 2019 09:46:53 +0100, a ecrit:
> > 'soread' has the comment:
> > 
> >         /*
> >          * No need to check if there's enough room to read.
> >          * soread wouldn't have been called if there weren't
> >          */
> >         sopreprbuf(so, iov, &n);
> > 
> > the compiler doesn't realise that, and is moaning about the case
> > where the if (len <=0) return happens and the following 
> > code tries to use iov.
> 
> I see. Perhaps we should make this an assert then? In case this isn't
> true, i.e. soread() is called even if no room is available, returning 0
> would probably just let the caller just try again, and we should rather
> just plainly crash than hang?

Adding the assert in soread sorts that case out:
  assert(sopreprbuf(so, iov, &n) != 0);

however, I also need to fix soreadbuf;  is it legal to call that with
a 0 size?

Dave

> Samuel
--
Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK

Reply via email to