-some fixes for monkey
[oweals/gnunet.git] / src / transport / transport-testing.c
index 87ce704232d9b43680561473d393be72b5b21944..035b8fe8ef41448ff5fdeb98f4506a4909eaaff2 100644 (file)
@@ -278,9 +278,10 @@ GNUNET_TRANSPORT_TESTING_start_peer (struct GNUNET_TRANSPORT_TESTING_handle *tth
                      "Testing library failed to create unique configuration based on `%s': `%s'\n",
                      cfgname, emsg);
     GNUNET_TRANSPORT_TESTING_stop_peer (tth, p);
+    GNUNET_free_non_null (emsg);
     return NULL;
   }
-
+  GNUNET_free_non_null (emsg);
   if (GNUNET_OK != GNUNET_TESTING_peer_start (p->peer))
   {
     GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, "transport-testing",
@@ -456,9 +457,9 @@ GNUNET_TRANSPORT_TESTING_stop_peer (struct GNUNET_TRANSPORT_TESTING_handle *tth,
 
 
 /**
- * Connect the given peers and call the callback when both peers report the
- * inbound connection. Remarks: start_peer's notify_connect callback can be called
- * before.
+ * Initiate a connection from p1 to p2 by offering p1 p2's HELLO message
+ *
+ * Remarks: start_peer's notify_connect callback can be called before.
  *
  * @param tth transport testing handle
  * @param p1 peer 1
@@ -611,7 +612,25 @@ extract_filename (const char *file)
   char *backup = pch;
   char *filename = NULL;
   char *res;
-
+#if WINDOWS
+  if ((strlen (pch) >= 3) && pch[1] == ':')
+  {
+    if (NULL != strstr (pch, "\\"))
+    {
+      pch = strtok (pch, "\\");
+      while (pch != NULL)
+      {
+        pch = strtok (NULL, "\\");
+        if (pch != NULL)
+          filename = pch;
+      }
+    }
+  }
+  if (filename != NULL)
+    pch = filename; /* If we miss the next condition, filename = pch will
+                     * not harm us.
+                     */
+#endif
   if (NULL != strstr (pch, "/"))
   {
     pch = strtok (pch, "/");