From 96431e0e23722548d43c24eb7b3407fe0293c31f Mon Sep 17 00:00:00 2001
From: Dave McCaldon <davem@intersys.com>
Date: Fri, 5 Feb 2010 11:22:24 -0500
Subject: [PATCH] Resolve compile issues on Solaris x64 and UltraSPARC
 Solaris builds of libssh2-1.2.3 failed on both x64 and UltraSPARC platforms because of two problems:
     1) src/agent.c:145  sun is a reserved word when using the SUNWspro compiler
     2) example/direct_tcpip.c:84  INADDR_NONE is not defined
 This patch resolves both of these issues.

---
 example/direct_tcpip.c |    4 ++++
 src/agent.c            |    8 ++++----
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/example/direct_tcpip.c b/example/direct_tcpip.c
index 06976ab..0e41f11 100644
--- a/example/direct_tcpip.c
+++ b/example/direct_tcpip.c
@@ -18,6 +18,10 @@
 #include <unistd.h>
 #include <sys/types.h>
 
+#ifndef INADDR_NONE
+#define INADDR_NONE (in_addr_t)-1
+#endif
+
 const char *keyfile1 = "/home/username/.ssh/id_rsa.pub";
 const char *keyfile2 = "/home/username/.ssh/id_rsa";
 const char *username = "username";
diff --git a/src/agent.c b/src/agent.c
index 9ff4ebb..4286d9b 100644
--- a/src/agent.c
+++ b/src/agent.c
@@ -142,7 +142,7 @@ static int
 agent_connect_unix(LIBSSH2_AGENT *agent)
 {
     const char *path;
-    struct sockaddr_un sun;
+    struct sockaddr_un s_un;
 
     path = getenv("SSH_AUTH_SOCK");
     if (!path) {
@@ -154,9 +154,9 @@ agent_connect_unix(LIBSSH2_AGENT *agent)
         return -1;
     }
 
-    sun.sun_family = AF_UNIX;
-    strncpy (sun.sun_path, path, sizeof sun.sun_path);
-    if (connect(agent->fd, (struct sockaddr*)(&sun), sizeof sun) != 0) {
+    s_un.sun_family = AF_UNIX;
+    strncpy (s_un.sun_path, path, sizeof s_un.sun_path);
+    if (connect(agent->fd, (struct sockaddr*)(&s_un), sizeof s_un) != 0) {
         close (agent->fd);
         return -1;
     }
-- 
1.6.4.4


