do not bind if port is zero
authorChristian Grothoff <christian@grothoff.org>
Wed, 23 Jun 2010 16:08:18 +0000 (16:08 +0000)
committerChristian Grothoff <christian@grothoff.org>
Wed, 23 Jun 2010 16:08:18 +0000 (16:08 +0000)
src/util/service.c

index a61c4a6c532ff21086621dbf0470305be591055b..c169a9d373670ffc056f76e250af9420e9787cb4 100644 (file)
@@ -913,6 +913,16 @@ GNUNET_SERVICE_get_server_addresses (const char *serviceName,
       GNUNET_free_non_null(hostname);
       return GNUNET_SYSERR;
     }
+  if (port == 0)
+    {
+      saddrs = GNUNET_malloc (2 * sizeof(struct sockaddr*));
+      saddrlens = GNUNET_malloc (2 * sizeof (socklen_t));
+      add_unixpath (saddrs, saddrlens, unixpath);
+      GNUNET_free_non_null (unixpath);
+      *addrs = saddrs;
+      *addr_lens = saddrlens;
+      return 1;
+    }
        
   if (hostname != NULL)
     {