gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r23838 - gnunet/src/util


From: gnunet
Subject: [GNUnet-SVN] r23838 - gnunet/src/util
Date: Mon, 17 Sep 2012 11:06:59 +0200

Author: wachs
Date: 2012-09-17 11:06:59 +0200 (Mon, 17 Sep 2012)
New Revision: 23838

Modified:
   gnunet/src/util/helper.c
Log:
fix for "bad address " issue with wlan helper

Modified: gnunet/src/util/helper.c
===================================================================
--- gnunet/src/util/helper.c    2012-09-16 17:36:13 UTC (rev 23837)
+++ gnunet/src/util/helper.c    2012-09-17 09:06:59 UTC (rev 23838)
@@ -136,7 +136,7 @@
   /**
    * NULL-terminated list of command-line arguments.
    */
-  char *const *binary_argv;
+  char **binary_argv;
                    
   /**
    * Task to read from the helper.
@@ -411,11 +411,18 @@
                     void *cb_cls)
 {
   struct GNUNET_HELPER_Handle*h;
-
+  int c = 0;
   h =  GNUNET_malloc (sizeof (struct GNUNET_HELPER_Handle));
   h->with_control_pipe = with_control_pipe;
-  h->binary_name = binary_name;
-  h->binary_argv = binary_argv;
+  h->binary_name = GNUNET_strdup (binary_name);
+
+  for (c = 0; binary_argv[c] != NULL; c++)
+    c ++;
+  h->binary_argv = GNUNET_malloc (sizeof (char *[c + 1]));
+  for (c = 0; binary_argv[c] != NULL; c++)
+    h->binary_argv[c] = GNUNET_strdup (binary_argv[c]);
+  h->binary_argv[c] = NULL;
+
   h->cb_cls = cb_cls;
   h->mst = GNUNET_SERVER_mst_create (cb, h->cb_cls);
   h->exp_cb = exp_cb;
@@ -433,7 +440,7 @@
 GNUNET_HELPER_stop (struct GNUNET_HELPER_Handle *h)
 {
   struct GNUNET_HELPER_SendHandle *sh;
-
+  int c;
   h->exp_cb = NULL;
   /* signal pending writes that we were stopped */
   while (NULL != (sh = h->sh_head))
@@ -447,6 +454,10 @@
   }
   stop_helper (h);
   GNUNET_SERVER_mst_destroy (h->mst);
+  GNUNET_free ((char *) h->binary_name);
+  for (c = 0; h->binary_argv[c] != NULL; c++)
+    GNUNET_free (h->binary_argv[c]);
+  GNUNET_free (h->binary_argv);
   GNUNET_free (h);
 }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]