Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
When you detect a cycle in a structure supposed to be acyclic, don't
authorsuter <frederic.suter@cc.in2p3.fr>
Tue, 26 Jun 2012 09:00:05 +0000 (11:00 +0200)
committersuter <frederic.suter@cc.in2p3.fr>
Tue, 26 Jun 2012 10:28:04 +0000 (12:28 +0200)
return it the user. Raise an error message and return nothing instead.

src/simdag/sd_daxloader.c

index 40b4e62..2bbd2c7 100644 (file)
@@ -384,8 +384,16 @@ xbt_dynar_t SD_daxload(const char *filename)
     }
   }
 
-  acyclic_graph_detail(result);
-  return result;
+  if (!acyclic_graph_detail(result)){
+    XBT_ERROR("The DAX described in %s is not a DAG. It contains a cycle.",
+              filename);
+    xbt_dynar_foreach(result, cpt, file)
+      SD_task_destroy(file);
+     xbt_dynar_free_container(&result);
+    return NULL;
+  } else {
+    return result;
+  }
 }
 
 void STag_dax__adag(void)