[PATCH libxtrans] Add TRANS(Listen) function to re-enable specific listen sockets

Hans de Goede hdegoede at redhat.com
Sat Sep 13 03:41:02 PDT 2014


Hi,

On 09/12/2014 08:33 PM, Keith Packard wrote:
> This will allow a server to disable listeners by default and then
> let later configuration re-enable them. In particular, this lets the X
> server disable inet and unix listen sockets by default while still
> providing a '-listen' command line option to re-enable them later on.
> 
> Signed-off-by: Keith Packard <keithp at keithp.com>

Looks good:

Reviewed-by: Hans de Goede <hdegoede at redhat.com>

Regards,

Hans


> ---
>  Xtrans.c | 25 +++++++++++++++++++++++++
>  Xtrans.h |  4 ++++
>  2 files changed, 29 insertions(+)
> 
> diff --git a/Xtrans.c b/Xtrans.c
> index 2880803..bfba1ad 100644
> --- a/Xtrans.c
> +++ b/Xtrans.c
> @@ -804,6 +804,31 @@ TRANS(NoListen) (const char * protocol)
>  }
>  
>  int
> +TRANS(Listen) (const char * protocol)
> +{
> +   Xtransport *trans;
> +   int i = 0, ret = 0;
> +
> +   if ((trans = TRANS(SelectTransport)(protocol)) == NULL)
> +   {
> +	prmsg (1,"TransListen: unable to find transport: %s\n",
> +	       protocol);
> +
> +	return -1;
> +   }
> +   if (trans->flags & TRANS_ALIAS) {
> +       if (trans->nolisten)
> +	   while (trans->nolisten[i]) {
> +	       ret |= TRANS(Listen)(trans->nolisten[i]);
> +	       i++;
> +       }
> +   }
> +
> +   trans->flags &= ~TRANS_NOLISTEN;
> +   return ret;
> +}
> +
> +int
>  TRANS(IsListening) (const char * protocol)
>  {
>     Xtransport *trans;
> diff --git a/Xtrans.h b/Xtrans.h
> index 6decc6b..026fbd7 100644
> --- a/Xtrans.h
> +++ b/Xtrans.h
> @@ -311,6 +311,10 @@ int TRANS(NoListen) (
>      const char*         /* protocol*/
>  );
>  
> +int TRANS(Listen) (
> +    const char*         /* protocol*/
> +);
> +
>  int TRANS(IsListening) (
>      const char*         /* protocol*/
>  );
> 


More information about the xorg-devel mailing list