-fix call to stats destroy
[oweals/gnunet.git] / src / vpn / gnunet-service-vpn.c
index 8f4d11bc9f5a99d2a9fe6c53d6876ee9988fdab2..796a4a6e109e0eaa0ef701f5b91768a40a0542c4 100644 (file)
@@ -284,6 +284,11 @@ struct TunnelState
 };
 
 
+/**
+ * Return value from 'main'.
+ */
+static int global_ret;
+
 /**
  * Configuration we use.
  */
@@ -2883,7 +2888,7 @@ cleanup (void *cls GNUNET_UNUSED,
   }
   if (stats != NULL)
   {
-    GNUNET_STATISTICS_destroy (stats, GNUNET_YES);
+    GNUNET_STATISTICS_destroy (stats, GNUNET_NO);
     stats = NULL;
   }
   for (i=0;i<5;i++)
@@ -3002,6 +3007,15 @@ run (void *cls,
   struct in_addr v4;
   struct in6_addr v6;
 
+  if (GNUNET_YES !=
+      GNUNET_OS_check_helper_binary ("gnunet-helper-vpn"))
+  {
+    fprintf (stderr,
+            "`%s' is not SUID, refusing to run.\n",
+            "gnunet-helper-vpn");
+    global_ret = 1;
+    return;
+  }
   cfg = cfg_;
   stats = GNUNET_STATISTICS_create ("vpn", cfg);
   if (GNUNET_OK !=
@@ -3112,7 +3126,7 @@ main (int argc, char *const *argv)
   return (GNUNET_OK ==
           GNUNET_SERVICE_run (argc, argv, "vpn", 
                              GNUNET_SERVICE_OPTION_NONE,
-                              &run, NULL)) ? 0 : 1;
+                              &run, NULL)) ? global_ret : 1;
 }
 
 /* end of gnunet-service-vpn.c */