From 81b0d877461c7f9c7fdaeba00854a9ed8ae3f163 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Cr=C3=AAte?= Date: Thu, 17 Mar 2011 16:41:52 -0400 Subject: [PATCH] shm: Don't use "sun" as a variable name, breaks on Solaris Seems like the Solaris compiler has -Dsun=1, so don't use sun as a variable name Patch by Tim Mooney https://bugzilla.gnome.org/show_bug.cgi?id=645053 --- sys/shm/shmpipe.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/sys/shm/shmpipe.c b/sys/shm/shmpipe.c index 209a13b254..6465e381c0 100644 --- a/sys/shm/shmpipe.c +++ b/sys/shm/shmpipe.c @@ -192,7 +192,7 @@ sp_writer_create (const char *path, size_t size, mode_t perms) { ShmPipe *self = spalloc_new (ShmPipe); int flags; - struct sockaddr_un sun; + struct sockaddr_un sock_un; int i = 0; memset (self, 0, sizeof (ShmPipe)); @@ -211,10 +211,10 @@ sp_writer_create (const char *path, size_t size, mode_t perms) if (fcntl (self->main_socket, F_SETFL, flags | O_NONBLOCK | FD_CLOEXEC) < 0) RETURN_ERROR ("fcntl(F_SETFL) failed (%d): %s\n", errno, strerror (errno)); - sun.sun_family = AF_UNIX; - strncpy (sun.sun_path, path, sizeof (sun.sun_path) - 1); + sock_un.sun_family = AF_UNIX; + strncpy (sock_un.sun_path, path, sizeof (sock_un.sun_path) - 1); - while (bind (self->main_socket, (struct sockaddr *) &sun, + while (bind (self->main_socket, (struct sockaddr *) &sock_un, sizeof (struct sockaddr_un)) < 0) { if (errno != EADDRINUSE) RETURN_ERROR ("bind() failed (%d): %s\n", errno, strerror (errno)); @@ -222,11 +222,11 @@ sp_writer_create (const char *path, size_t size, mode_t perms) if (i > 256) RETURN_ERROR ("Could not find a free socket name for %s", path); - snprintf (sun.sun_path, sizeof (sun.sun_path), "%s.%d", path, i); + snprintf (sock_un.sun_path, sizeof (sock_un.sun_path), "%s.%d", path, i); i++; } - self->socket_path = strdup (sun.sun_path); + self->socket_path = strdup (sock_un.sun_path); if (listen (self->main_socket, LISTEN_BACKLOG) < 0) RETURN_ERROR ("listen() failed (%d): %s\n", errno, strerror (errno)); @@ -744,7 +744,7 @@ ShmPipe * sp_client_open (const char *path) { ShmPipe *self = spalloc_new (ShmPipe); - struct sockaddr_un sun; + struct sockaddr_un sock_un; memset (self, 0, sizeof (ShmPipe)); @@ -754,10 +754,10 @@ sp_client_open (const char *path) if (self->main_socket < 0) goto error; - sun.sun_family = AF_UNIX; - strncpy (sun.sun_path, path, sizeof (sun.sun_path) - 1); + sock_un.sun_family = AF_UNIX; + strncpy (sock_un.sun_path, path, sizeof (sock_un.sun_path) - 1); - if (connect (self->main_socket, (struct sockaddr *) &sun, + if (connect (self->main_socket, (struct sockaddr *) &sock_un, sizeof (struct sockaddr_un)) < 0) goto error;