-fix ftbfs
[oweals/gnunet.git] / src / sensor / gnunet-service-sensor_monitoring.c
index 38b5f65da2348b6403b790711f77ac36bf71bdde..145e81c7977b645e1810146d1e7ca1ae1ce3aa07 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     (C)
+     Copyright (C)
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -200,7 +200,8 @@ end_sensor_run_stat (void *cls, int success)
  * @return size of new parsed value, 0 for error
  */
 static size_t
-parse_sensor_value (const char *value, struct GNUNET_SENSOR_SensorInfo *sensor,
+parse_sensor_value (const char *value,
+                    struct GNUNET_SENSOR_SensorInfo *sensor,
                     void **ret)
 {
   double *dval;
@@ -215,7 +216,11 @@ parse_sensor_value (const char *value, struct GNUNET_SENSOR_SensorInfo *sensor,
 
     *dval = strtod (value, &endptr);
     if (value == endptr)
+    {
+      GNUNET_free (dval);
+      *ret = NULL;
       return 0;
+    }
     *ret = dval;
     return sizeof (double);
   }
@@ -330,6 +335,8 @@ sensor_run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
                                                                 &end_sensor_run_stat,
                                                                 &sensor_statistics_iterator,
                                                                 sensorinfo);
+    if (NULL == sensorinfo->gnunet_stat_get_handle)
+      sensorinfo->running = GNUNET_NO;
   }
   else if (0 == strcmp ("process", sensorinfo->source))
   {
@@ -405,7 +412,7 @@ schedule_sensor (void *cls, const struct GNUNET_HashCode *key, void *value)
   LOG (GNUNET_ERROR_TYPE_DEBUG,
        "Scheduling sensor `%s' to run after %" PRIu64 " microseconds\n",
        sensorinfo->name, sensorinfo->interval.rel_value_us);
-  if (GNUNET_SCHEDULER_NO_TASK != sensorinfo->execution_task)
+  if (NULL != sensorinfo->execution_task)
   {
     LOG (GNUNET_ERROR_TYPE_ERROR,
          _("Sensor `%s' execution task already set, this should not happen\n"),