bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: interix 3.5 select bug


From: Markus Duft
Subject: RE: interix 3.5 select bug
Date: Fri, 13 Mar 2009 07:53:57 +0100

> 
> Jim Meyering wrote:
> > > +  /* Interix 3.5 has a bug: it does not support nfds == 0.  */
> > > +  if (nfds == 0)
> > > +    {
> > > +      nfds = 1;
> > > +      rfds = NULL;
> > > +      wfds = NULL;
> > > +      xfds = NULL;
> > > +    }
> >
> > Did you consider doing the above only when all three input pointers
> > are NULL?
> 
> No, I didn't. According to POSIX
> select (0, rfds, wfds, xfds, timeout)     is supposed to be equivalent
> to
> select (0, NULL, NULL, NULL, timeout)     and supposed to be equivalent
> to
> select (n, NULL, NULL, NULL, timeout) for any n > 0. So, on POSIX
> systems,
> this transformation is correct, and on Interix, Markus Duft said that
> he
> verified that changing nfds from 0 to 1 made the problem go away.
> 
> > I have a slight preference not to map the suspicious
> > combination of nfds==0 and one or more non-NULL pointer arg.
> > to arguments that provoke no diagnostic on that system.
> 
> Huh? The point of the workaround is to make
>   select (0, rfds, wfds, xfds, timeout)
> work according to POSIX, regardless which of the three arguments are
> NULL or non-NULL. What would be the point of activating the workaround
> for 1 out of 8 combinations and not for the other 7 cases?

+1. I must admit, that I haven't tried, but I feel that interix 3.5 select
will behave the same with non-null arguments as well. Even if it doesn't,
there seems nothing wrong with this, except for the case where one of the
pointer args really contains a valid fd_set, containing a valid fd at index
0, and the user wanting to _not_ test any fd. But... I guess one could say
that would be really the programmers fault, right?

Cheers, Markus

> 
> Bruno
> 
> 






reply via email to

[Prev in Thread] Current Thread [Next in Thread]