[beagle] Rename "sun" identifier to fix build on Solaris



commit f54a11a13c53d6c8ed791b058cd8a5119f76e258
Author: Joe Shaw <joe joeshaw org>
Date:   Sun May 17 10:49:36 2009 -0400

    Rename "sun" identifier to fix build on Solaris
    
    Apparently "sun" is a reserved keyword for the Solaris compiler,
    so rename our uses of it to "saddr_un" to get it to compile.
    Based on a patch by Daniel Vergien <daniel vergien rrz uni-hamburg de>.
---
 libbeagle/beagle/beagle-request.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/libbeagle/beagle/beagle-request.c b/libbeagle/beagle/beagle-request.c
index 4c6b745..adef39a 100644
--- a/libbeagle/beagle/beagle-request.c
+++ b/libbeagle/beagle/beagle-request.c
@@ -180,7 +180,7 @@ _beagle_connect_timeout (const char *path, GError **err)
 	long mode;
 	fd_set select_set;
 	struct timeval tv;
-	struct sockaddr_un sun;
+	struct sockaddr_un saddr_un;
 
 	sockfd = socket (AF_UNIX, SOCK_STREAM, 0);
 	if (sockfd < 0) {
@@ -204,9 +204,9 @@ _beagle_connect_timeout (const char *path, GError **err)
 		return -1;
 	}
 
-	bzero (&sun, sizeof (sun));
-	sun.sun_family = AF_UNIX;
-	snprintf (sun.sun_path, sizeof (sun.sun_path), path);
+	bzero (&saddr_un, sizeof (saddr_un));
+	saddr_un.sun_family = AF_UNIX;
+	strncpy (saddr_un.sun_path, path, sizeof (saddr_un.sun_path));
 
 	/* We retry on EGAIN or EINTR: since both of these mean the socket is active,
 	 * there is no harm in trying to retry a lot of times. A blocking socket would
@@ -217,7 +217,7 @@ _beagle_connect_timeout (const char *path, GError **err)
 #define MAX_RETRIES 10 /* 10 * 200 msec ~> 2 sec */
 
 	for (retries = 0; retries < MAX_RETRIES; ++ retries) {
-		if (connect (sockfd, (struct sockaddr *) &sun, sizeof (sun)) >= 0)
+		if (connect (sockfd, (struct sockaddr *) &saddr_un, sizeof (saddr_un)) >= 0)
 			break;
 
 		/* Else, connection un-successful */



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