Merge branch 'master' of github:szmoore/MCTX3420
[matches/MCTX3420.git] / server / sensor.c
index 816a895..ae5cdf4 100644 (file)
@@ -122,11 +122,15 @@ void Sensor_SetMode(Sensor * s, ControlModes mode, void * arg)
                        {
                                // Set filename
                                char filename[BUFSIZ];
-                               const char *experiment_name = (const char*) arg;
+                               const char *experiment_path = (const char*) arg;
+                               int ret;
+
+                               ret = snprintf(filename, BUFSIZ, "%s/sensor_%d", experiment_path, s->id);
 
-                               if (snprintf(filename, BUFSIZ, "%s_%d", experiment_name, s->id) >= BUFSIZ)
+                               if (ret >= BUFSIZ) 
                                {
-                                       Fatal("Experiment name \"%s\" too long (>%d)", experiment_name, BUFSIZ);
+                                       Fatal("Experiment path \"%s\" too long (%d, limit %d)",
+                                                       experiment_path, ret, BUFSIZ);
                                }
 
                                Log(LOGDEBUG, "Sensor %d with DataFile \"%s\"", s->id, filename);
@@ -306,7 +310,6 @@ void Sensor_Handler(FCGIContext *context, char * params)
        struct timespec now;
        clock_gettime(CLOCK_MONOTONIC, &now);
        double current_time = TIMEVAL_DIFF(now, *Control_GetStartTime());
-
        int id = 0;
        const char * name = "";
        double start_time = 0;

UCC git Repository :: git.ucc.asn.au