gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r25907 - gnunet/src/arm


From: gnunet
Subject: [GNUnet-SVN] r25907 - gnunet/src/arm
Date: Fri, 25 Jan 2013 17:02:41 +0100

Author: grothoff
Date: 2013-01-25 17:02:41 +0100 (Fri, 25 Jan 2013)
New Revision: 25907

Modified:
   gnunet/src/arm/arm_api.c
Log:
start gnunet-service-arm nicely if configuration file does not exist

Modified: gnunet/src/arm/arm_api.c
===================================================================
--- gnunet/src/arm/arm_api.c    2013-01-25 15:28:08 UTC (rev 25906)
+++ gnunet/src/arm/arm_api.c    2013-01-25 16:02:41 UTC (rev 25907)
@@ -359,17 +359,7 @@
   if (GNUNET_OK !=
       GNUNET_CONFIGURATION_get_value_filename (pos->h->cfg, "arm", "CONFIG",
                                               &config))
-  {
-    GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING,
-                              "arm", "CONFIG");
-    if (pos->callback != NULL)
-      pos->callback (pos->cls, GNUNET_ARM_PROCESS_UNKNOWN);
-    GNUNET_free (cbinary);
-    GNUNET_free (pos);
-    GNUNET_free (loprefix);
-    GNUNET_free (lopostfix);
-    return;
-  }
+    config = NULL;
   binary = GNUNET_OS_get_libexec_binary_path (cbinary);
   GNUNET_free (cbinary);
   if ((GNUNET_YES ==
@@ -383,28 +373,39 @@
   {
     /* Means we are ONLY running locally */
     /* we're clearly running a test, don't daemonize */
-    proc = do_start_process (GNUNET_NO, pos->std_inheritance,
-                            NULL, loprefix, binary, "-c", config,
-                            /* no daemonization! */
-                            lopostfix, NULL);
+    if (NULL == config)
+      proc = do_start_process (GNUNET_NO, pos->std_inheritance,
+                              NULL, loprefix, binary,
+                              /* no daemonization! */
+                              lopostfix, NULL);
+    else
+      proc = do_start_process (GNUNET_NO, pos->std_inheritance,
+                              NULL, loprefix, binary, "-c", config,
+                              /* no daemonization! */
+                              lopostfix, NULL);
   }
   else
   {
-    proc = do_start_process (GNUNET_NO, pos->std_inheritance,
-                            NULL, loprefix, binary, "-c", config,
-                            "-d", lopostfix, NULL);
+    if (NULL == config)
+      proc = do_start_process (GNUNET_NO, pos->std_inheritance,
+                              NULL, loprefix, binary,
+                              "-d", lopostfix, NULL);
+    else
+      proc = do_start_process (GNUNET_NO, pos->std_inheritance,
+                              NULL, loprefix, binary, "-c", config,
+                              "-d", lopostfix, NULL);
   }
   GNUNET_free (binary);
-  GNUNET_free (config);
+  GNUNET_free_non_null (config);
   GNUNET_free (loprefix);
   GNUNET_free (lopostfix);
-  if (proc == NULL)
-    {
-      if (pos->callback != NULL)
-       pos->callback (pos->cls, GNUNET_ARM_PROCESS_FAILURE);
-      GNUNET_free (pos);
-      return;
-    }
+  if (NULL == proc)
+  {
+    if (pos->callback != NULL)
+      pos->callback (pos->cls, GNUNET_ARM_PROCESS_FAILURE);
+    GNUNET_free (pos);
+    return;
+  }
   if (pos->callback != NULL)
     pos->callback (pos->cls, GNUNET_ARM_PROCESS_STARTING);
   GNUNET_free (proc);




reply via email to

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