OSSP CVS Repository

ossp - Difference in ossp-pkg/sa/sa.c versions 1.68 and 1.69
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/sa/sa.c 1.68 -> 1.69

--- sa.c 2002/11/07 06:24:08     1.68
+++ sa.c 2002/11/07 12:17:06     1.69
@@ -47,7 +47,7 @@
 #include <sys/time.h>    /* for "struct timeval" */
 #include <sys/un.h>      /* for "struct sockaddr_un" */
 #include <netinet/in.h>  /* for "struct sockaddr_in[6]" */
-#include <sys/socket.h>  /* for "PF_XXX", "AF_XXX" and "SOCK_XXX" */
+#include <sys/socket.h>  /* for "PF_XXX", "AF_XXX", "SOCK_XXX" and "SHUT_XX" */
 #include <arpa/inet.h>   /* for "inet_XtoX" */
 
 /* include own API header */
@@ -90,6 +90,19 @@
 #define PF_INET6 AF_INET6
 #endif
 
+/* backward compatibility for SHUT_XX. Some platforms (like brain-dead
+   OpenUNIX) define those only if _XOPEN_SOURCE is defined, but unfortunately
+   then fail in their other vendor includes due to internal inconsistencies. */
+#if !defined(SHUT_RD)
+#define SHUT_RD 0
+#endif
+#if !defined(SHUT_WR)
+#define SHUT_WR 1
+#endif
+#if !defined(SHUT_RDWR)
+#define SHUT_RDWR 2
+#endif
+
 /* backward compatibility for ssize_t */
 #if defined(HAVE_CONFIG_H) && !defined(HAVE_SSIZE_T)
 #define ssize_t long
@@ -1508,7 +1521,7 @@
         struct sockaddr_in6 sa6;
 #endif
     } sa_buf;
-    socklen_t sa_len;
+    socklen_t sa_size;
     int s;
     int i;
 
@@ -1539,14 +1552,14 @@
     }
 
     /* perform accept operation on underlying socket */
-    sa_len = sizeof(sa_buf);
-    if ((s = SA_SC_CALL_3(sa, accept, sa->fdSocket, (struct sockaddr *)&sa_buf, &sa_len)) == -1)
+    sa_size = sizeof(sa_buf);
+    if ((s = SA_SC_CALL_3(sa, accept, sa->fdSocket, (struct sockaddr *)&sa_buf, &sa_size)) == -1)
         return SA_RC(SA_ERR_SYS);
 
     /* create result address object */
     if ((rv = sa_addr_create(caddr)) != SA_OK)
         return SA_RC(rv);
-    if ((rv = sa_addr_s2a(*caddr, (struct sockaddr *)&sa_buf, sa_len)) != SA_OK) {
+    if ((rv = sa_addr_s2a(*caddr, (struct sockaddr *)&sa_buf, sa_size)) != SA_OK) {
         sa_addr_destroy(*caddr);
         return SA_RC(rv);
     }
@@ -1588,7 +1601,7 @@
         struct sockaddr_in6 sa6;
 #endif
     } sa_buf;
-    socklen_t sa_len;
+    socklen_t sa_size;
 
     /* argument sanity check(s) */
     if (sa == NULL || raddr == NULL)
@@ -1603,14 +1616,14 @@
         return SA_RC(SA_ERR_USE);
 
     /* determine remote address of underlying socket */
-    sa_len = sizeof(sa_buf);
-    if (getpeername(sa->fdSocket, (struct sockaddr *)&sa_buf, &sa_len) < 0)
+    sa_size = sizeof(sa_buf);
+    if (getpeername(sa->fdSocket, (struct sockaddr *)&sa_buf, &sa_size) < 0)
         return SA_RC(SA_ERR_SYS);
 
     /* create result address object */
     if ((rv = sa_addr_create(raddr)) != SA_OK)
         return SA_RC(rv);
-    if ((rv = sa_addr_s2a(*raddr, (struct sockaddr *)&sa_buf, sa_len)) != SA_OK) {
+    if ((rv = sa_addr_s2a(*raddr, (struct sockaddr *)&sa_buf, sa_size)) != SA_OK) {
         sa_addr_destroy(*raddr);
         return SA_RC(rv);
     }
@@ -1628,7 +1641,7 @@
         struct sockaddr_in6 sa6;
 #endif
     } sa_buf;
-    socklen_t sa_len;
+    socklen_t sa_size;
 
     /* argument sanity check(s) */
     if (sa == NULL || laddr == NULL)
@@ -1639,14 +1652,14 @@
         return SA_RC(SA_ERR_USE);
 
     /* determine local address of underlying socket */
-    sa_len = sizeof(sa_buf);
-    if (getsockname(sa->fdSocket, (struct sockaddr *)&sa_buf, &sa_len) < 0)
+    sa_size = sizeof(sa_buf);
+    if (getsockname(sa->fdSocket, (struct sockaddr *)&sa_buf, &sa_size) < 0)
         return SA_RC(SA_ERR_SYS);
 
     /* create result address object */
     if ((rv = sa_addr_create(laddr)) != SA_OK)
         return SA_RC(rv);
-    if ((rv = sa_addr_s2a(*laddr, (struct sockaddr *)&sa_buf, sa_len)) != SA_OK) {
+    if ((rv = sa_addr_s2a(*laddr, (struct sockaddr *)&sa_buf, sa_size)) != SA_OK) {
         sa_addr_destroy(*laddr);
         return SA_RC(rv);
     }
@@ -2085,7 +2098,7 @@
         struct sockaddr_in6 sa6;
 #endif
     } sa_buf;
-    socklen_t sa_len;
+    socklen_t sa_size;
     size_t n;
     fd_set fds;
 
@@ -2117,15 +2130,15 @@
     }
 
     /* perform receive operation on underlying socket */
-    sa_len = sizeof(sa_buf);
+    sa_size = sizeof(sa_buf);
     if ((n = SA_SC_CALL_6(sa, recvfrom, sa->fdSocket, buf, buflen, 0,
-                          (struct sockaddr *)&sa_buf, &sa_len)) == -1)
+                          (struct sockaddr *)&sa_buf, &sa_size)) == -1)
         return SA_RC(SA_ERR_SYS);
 
     /* create result address object */
     if ((rv = sa_addr_create(raddr)) != SA_OK)
         return rv;
-    if ((rv = sa_addr_s2a(*raddr, (struct sockaddr *)&sa_buf, sa_len)) != SA_OK) {
+    if ((rv = sa_addr_s2a(*raddr, (struct sockaddr *)&sa_buf, sa_size)) != SA_OK) {
         sa_addr_destroy(*raddr);
         return rv;
     }

CVSTrac 2.0.1