-fixing #2243
authorChristian Grothoff <christian@grothoff.org>
Sun, 1 Apr 2012 09:58:45 +0000 (09:58 +0000)
committerChristian Grothoff <christian@grothoff.org>
Sun, 1 Apr 2012 09:58:45 +0000 (09:58 +0000)
src/dns/gnunet-service-dns.c
src/exit/gnunet-daemon-exit.c

index 37d2fbca8a57d13fb95f2055904d9fd2d8a92f3c..fbb27e4bc3a0d6dfb7f23721bb13b5200721fa23 100644 (file)
@@ -289,6 +289,11 @@ struct TunnelState
 };
 
 
+/**
+ * Global return value from 'main'.
+ */
+static int global_ret;
+
 /**
  * The configuration to use
  */
@@ -1552,6 +1557,16 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
   struct in6_addr dns_exit6;
 
   cfg = cfg_;
+  if (GNUNET_YES !=
+      GNUNET_OS_check_helper_binary ("gnunet-helper-dns"))
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+               _("`%s' must be installed SUID, refusing to run\n"),
+               "gnunet-helper-dns");
+    global_ret = 1;
+    return;
+  }
+
   stats = GNUNET_STATISTICS_create ("dns", cfg);
   nc = GNUNET_SERVER_notification_context_create (server, 1);
   GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &cleanup_task,
@@ -1662,7 +1677,7 @@ main (int argc, char *const *argv)
 {
   return (GNUNET_OK ==
           GNUNET_SERVICE_run (argc, argv, "dns", GNUNET_SERVICE_OPTION_NONE,
-                              &run, NULL)) ? 0 : 1;
+                              &run, NULL)) ? global_ret : 1;
 }
 
 
index 3bf26d7b8abb43e0a043a0aae57b73456aa1d582..07804c59237196ae11cbe0379b94c6cf313b3860 100644 (file)
@@ -3027,9 +3027,9 @@ run (void *cls, char *const *args GNUNET_UNUSED,
   if (GNUNET_YES !=
       GNUNET_OS_check_helper_binary ("gnunet-helper-exit"))
   {
-    fprintf (stderr,
-            "`%s' is not SUID, refusing to run.\n",
-            "gnunet-helper-exit");
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+               _("`%s' must be installed SUID, refusing to run\n"),
+               "gnunet-helper-exit");
     global_ret = 1;
     return;
   }