[xiph-cvs] cvs commit: net sock.c

Brendan brendan at xiph.org
Tue Jun 3 11:29:23 PDT 2003



brendan     03/06/03 14:29:23

  Modified:    .        sock.c
  Log:
  Karl's patch for a namespace collision he reports on some BSD systems.

Revision  Changes    Path
1.23      +8 -7      net/sock.c

Index: sock.c
===================================================================
RCS file: /usr/local/cvsroot/net/sock.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -p -u -r1.22 -r1.23
--- sock.c	29 May 2003 12:18:04 -0000	1.22
+++ sock.c	3 Jun 2003 18:29:23 -0000	1.23
@@ -1,3 +1,4 @@
+/* -*- c-basic-offset: 4; -*- */
 /* sock.c
  * - General Socket Functions
  *
@@ -592,7 +593,7 @@ sock_t sock_get_server_socket(const int 
 #else    
     struct sockaddr_in sa;
 #endif
-    int sa_family, sa_len, error, opt;
+    int family, len, error, opt;
     sock_t sock;
     char ip[MAX_ADDR_LEN];
 
@@ -601,8 +602,8 @@ sock_t sock_get_server_socket(const int 
 
     /* defaults */
     memset(&sa, 0, sizeof(sa));
-    sa_family = AF_INET;
-    sa_len = sizeof(struct sockaddr_in);
+    family = AF_INET;
+    len = sizeof(struct sockaddr_in);
 
     /* set the interface to bind to if specified */
     if (sinterface != NULL) {
@@ -615,8 +616,8 @@ sock_t sock_get_server_socket(const int 
             ((struct sockaddr_in*)&sa)->sin_port = htons(port);
         } else if (inet_pton(AF_INET6, ip, 
                     &((struct sockaddr_in6*)&sa)->sin6_addr) > 0) {
-            sa_family = AF_INET6;
-            sa_len = sizeof (struct sockaddr_in6);
+            family = AF_INET6;
+            len = sizeof (struct sockaddr_in6);
             ((struct sockaddr_in6*)&sa)->sin6_family = AF_INET6;
             ((struct sockaddr_in6*)&sa)->sin6_port = htons(port);
         } else {
@@ -637,7 +638,7 @@ sock_t sock_get_server_socket(const int 
     }
 
     /* get a socket */
-    sock = socket(sa_family, SOCK_STREAM, 0);
+    sock = socket(family, SOCK_STREAM, 0);
     if (sock == -1)
         return SOCK_ERROR;
 
@@ -646,7 +647,7 @@ sock_t sock_get_server_socket(const int 
     setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (const void *)&opt, sizeof(int));
     
     /* bind socket to port */
-    error = bind(sock, (struct sockaddr *)&sa, sa_len);
+    error = bind(sock, (struct sockaddr *)&sa, len);
     if (error == -1)
         return SOCK_ERROR;
 

<p><p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list