implement impl_in_flight API for MQ, replacing evacuation
[oweals/gnunet.git] / src / util / network.c
index 489966426286991830fab146352f2290d7ed2428..7f02395c66dbe72d6e235ac76150c20798173cc4 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     Copyright (C) 2009-2013 Christian Grothoff (and other contributing authors)
+     Copyright (C) 2009-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
@@ -166,6 +166,12 @@ GNUNET_NETWORK_unix_precheck (const struct sockaddr_un *un)
   int ret;
 
   s = socket (AF_UNIX, SOCK_STREAM, 0);
+  if (-1 == s)
+  {
+    GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING,
+                         "Failed to open AF_UNIX socket");
+    return;
+  }
   ret = connect (s,
                  (struct sockaddr *) un,
                  sizeof (struct sockaddr_un));
@@ -195,7 +201,7 @@ GNUNET_NETWORK_unix_precheck (const struct sockaddr_un *un)
 
 
 #ifndef FD_COPY
-#define FD_COPY(s, d) (memcpy ((d), (s), sizeof (fd_set)))
+#define FD_COPY(s, d) do { GNUNET_memcpy ((d), (s), sizeof (fd_set)); } while (0)
 #endif
 
 
@@ -540,7 +546,7 @@ GNUNET_NETWORK_socket_bind (struct GNUNET_NETWORK_Handle *desc,
     return GNUNET_SYSERR;
 #ifndef MINGW
   desc->addr = GNUNET_malloc (address_len);
-  memcpy (desc->addr, address, address_len);
+  GNUNET_memcpy (desc->addr, address, address_len);
   desc->addrlen = address_len;
 #endif
   return GNUNET_OK;
@@ -1204,7 +1210,7 @@ GNUNET_NETWORK_fdset_copy (struct GNUNET_NETWORK_FDSet *to,
     GNUNET_array_grow (to->handles,
                        to->handles_size,
                        from->handles_pos * 2);
-  memcpy (to->handles,
+  GNUNET_memcpy (to->handles,
           from->handles,
           from->handles_pos * sizeof (struct GNUNET_NETWORK_Handle *));
   to->handles_pos = from->handles_pos;