[PATCH 1/3] os: Add -displayfd option.

Adam Jackson ajax at redhat.com
Fri Jan 7 09:44:13 PST 2011


On Fri, 2011-01-07 at 00:02 +0100, Julien Cristau wrote:
> On Thu, Jan  6, 2011 at 17:28:59 -0500, Adam Jackson wrote:
> > +static Bool
> > +TryCreateSocket(int num, int *partial)
> > +{
> > +    char port[20];
> > +
> > +    sprintf(port, "%d", num);
> > +
> > +    return _XSERVTransMakeAllCOTSServerListeners(port, partial,
> > +						 &ListenTransCount,
> > +						 &ListenTransConns);
> 
> Cast from int to Bool, _XSERVTransMakeAllCOTSServerListeners seems to
> return 0 on success, I guess this should return
> _XSERVTransMakeAllCOTSServerListeners() >= 0?

Good point, though the rest of the code seems to work correctly with
that inversion.

> > +    else /* -displayfd */
> > +    {
> > +	Bool found = 0;
> > +	for (i = 0; i < 65535 - 1024; i++)
> 
> Should this be 65535 - 6000?

Yeah.  I was trying to avoid binding to reserved ports but clearly
that's not what that does, and apparently asking for a display number
that would wrap around into the 1025..5999 range doesn't work anyway.

- ajax



More information about the xorg-devel mailing list