bugfix
[oweals/gnunet.git] / src / util / service.c
index 732dbe9af94c49488373618572b4b8592fa58e02..0569a0fde698c079a56da25a1d75feb7071dcdce 100644 (file)
@@ -900,7 +900,8 @@ setup_service (struct GNUNET_SERVICE_Context *sctx)
       if (pos == NULL)
         {
           GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                      _("Failed to find IPv4 address for `%s'.\n"), hostname);
+                      _("Failed to find %saddress for `%s'.\n"),
+                     disablev6 ? "IPv4 " : "", hostname);
           freeaddrinfo (res);
           GNUNET_free (hostname);
           return GNUNET_SYSERR;
@@ -924,6 +925,7 @@ setup_service (struct GNUNET_SERVICE_Context *sctx)
           GNUNET_assert (pos->ai_addrlen == sizeof (struct sockaddr_in6));
           sctx->addrlen = pos->ai_addrlen;
           sctx->addr = GNUNET_malloc (sctx->addrlen);
+          memcpy (sctx->addr, res->ai_addr, sctx->addrlen);
           GNUNET_log (GNUNET_ERROR_TYPE_INFO,
                       _
                       ("Configured to bind to %s address; %s connections to this service will fail!\n"),
@@ -1154,7 +1156,7 @@ detach_terminal (struct GNUNET_SERVICE_Context *sctx)
   GNUNET_break (0 == CLOSE (0));
   GNUNET_break (0 == CLOSE (1));
   GNUNET_break (0 == CLOSE (filedes[0]));
-  nullfd = GNUNET_DISK_file_open ("/dev/null", O_RDWR | O_APPEND);
+  nullfd = OPEN ("/dev/null", O_RDWR | O_APPEND);
   if (nullfd < 0)
     return GNUNET_SYSERR;
   /* set stdin/stdout to /dev/null */