[PATCH:xscope 1/3] Rename sockaddr_un variable from sun to saun to avoid conflict with #define sun

Peter Hutterer peter.hutterer at who-t.net
Thu Oct 18 23:14:21 PDT 2012


On Thu, Oct 18, 2012 at 10:37:48PM -0700, Alan Coopersmith wrote:
> Compilers auto-define "sun" on Solaris/SunOS, which causes the variable
> name to turn into a constant "1", breaking the parsing of the code.
> 
> Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>

Series Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

Cheers,
   Peter

> ---
>  fd.c |   10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/fd.c b/fd.c
> index 8ac3e89..a9f6d4f 100644
> --- a/fd.c
> +++ b/fd.c
> @@ -309,7 +309,7 @@ MakeConnection(const char *server, short port, int report,
>  #else                           /* !USE_XTRANS */
>      char HostName[512];
>      struct sockaddr_in sin;
> -    struct sockaddr_un sun;
> +    struct sockaddr_un saun;
>      struct sockaddr *saddr;
>      int salen;
>      struct hostent *hp;
> @@ -323,11 +323,11 @@ MakeConnection(const char *server, short port, int report,
>      /* establish a socket to the name server for this host */
>      /* determine the host machine for this process */
>      if (*server == '\0') {
> -        sun.sun_family = AF_UNIX;
> -        snprintf(sun.sun_path, sizeof(sun.sun_path),
> +        saun.sun_family = AF_UNIX;
> +        snprintf(saun.sun_path, sizeof(saun.sun_path),
>                   "/tmp/.X11-unix/X%d", port - 6000);
> -        salen = sizeof(sun.sun_family) + strlen(sun.sun_path) + 1;
> -        saddr = (struct sockaddr *) &sun;
> +        salen = sizeof(saun.sun_family) + strlen(saun.sun_path) + 1;
> +        saddr = (struct sockaddr *) &saun;
>      }
>      else {
>          debug(4, (stderr, "try to connect on %s\n", server));
> -- 
> 1.7.9.2
> 
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
> 


More information about the xorg-devel mailing list