ack florian
[oweals/gnunet.git] / src / util / gnunet-service-resolver.c
index 067dfefc9eff0947d0075619726c5f148aa73c26..a87b1f5d05c5b2f0b0321531076944e045be5a9a 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     Copyright (C) 2007-2013 Christian Grothoff (and other contributing authors)
+     Copyright (C) 2007-2013 GNUnet e.V.
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -14,8 +14,8 @@
 
      You should have received a copy of the GNU General Public License
      along with GNUnet; see the file COPYING.  If not, write to the
-     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-     Boston, MA 02111-1307, USA.
+     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+     Boston, MA 02110-1301, USA.
 */
 
 /**
@@ -267,7 +267,7 @@ get_ip_as_string (struct GNUNET_SERVER_Client *client,
   {
     pos = GNUNET_malloc (sizeof (struct IPCache) + ip_len);
     pos->ip = &pos[1];
-    memcpy (&pos[1], ip, ip_len);
+    GNUNET_memcpy (&pos[1], ip, ip_len);
     pos->last_request = now;
     pos->last_refresh = now;
     pos->ip_len = ip_len;
@@ -365,10 +365,11 @@ getaddrinfo_resolve (struct GNUNET_SERVER_TransmitContext *tc,
   freeaddrinfo (result);
   return GNUNET_OK;
 }
-#endif
 
 
-#if HAVE_GETHOSTBYNAME2
+#elif HAVE_GETHOSTBYNAME2
+
+
 static int
 gethostbyname2_resolve (struct GNUNET_SERVER_TransmitContext *tc,
                         const char *hostname,
@@ -424,10 +425,10 @@ gethostbyname2_resolve (struct GNUNET_SERVER_TransmitContext *tc,
   }
   return GNUNET_OK;
 }
-#endif
+
+#elif HAVE_GETHOSTBYNAME
 
 
-#if HAVE_GETHOSTBYNAME
 static int
 gethostbyname_resolve (struct GNUNET_SERVER_TransmitContext *tc,
                        const char *hostname)
@@ -478,12 +479,10 @@ get_ip_from_hostname (struct GNUNET_SERVER_Client *client,
 #if HAVE_GETADDRINFO
   if (ret == GNUNET_NO)
     ret = getaddrinfo_resolve (tc, hostname, af);
-#endif
-#if HAVE_GETHOSTBYNAME2
+#elif HAVE_GETHOSTBYNAME2
   if (ret == GNUNET_NO)
     ret = gethostbyname2_resolve (tc, hostname, af);
-#endif
-#if HAVE_GETHOSTBYNAME
+#elif HAVE_GETHOSTBYNAME
   if ((ret == GNUNET_NO) && ((af == AF_UNSPEC) || (af == PF_INET)))
     gethostbyname_resolve (tc, hostname);
 #endif
@@ -630,7 +629,7 @@ main (int argc, char *const *argv)
   return ret;
 }
 
-#ifdef LINUX
+#if defined(LINUX) && defined(__GLIBC__)
 #include <malloc.h>
 
 /**