Commit 731ef59c authored by Antoine Kaufmann's avatar Antoine Kaufmann
Browse files

LostIO: Fix fuer Race-Condition beim Anlegen von neuen Knoten


! LostIO: Fix fuer Race-Condition beim Anlegen von neuen Knoten. Dabei
          wurde der Knoten erst nach dem Eintragen beim Vater-Knoten als
          Kind fertig initialisiert. Weiter hat da auch ein p/v()
	  gefehlt.
Signed-off-by: Antoine Kaufmann's avatarAntoine Kaufmann <toni@tyndur.org>
parent 6fb33c25
No related merge requests found
Showing with 7 additions and 3 deletions
+7 -3
......@@ -217,8 +217,6 @@ bool vfstree_create_child(vfstree_node_t* parent, char* name, typeid_t type, siz
{
vfstree_node_t* new_file = malloc(sizeof(vfstree_node_t));
parent->children = list_push((list_t*)parent->children, (void*) new_file);
parent->size++;
new_file->type = type;
new_file->name = malloc(strlen(name) + 1);
......@@ -228,9 +226,15 @@ bool vfstree_create_child(vfstree_node_t* parent, char* name, typeid_t type, siz
new_file->data = data;
new_file->flags = flags;
new_file->resid = next_resid++;
new_file->children = list_create();
new_file->parent = parent;
p();
new_file->resid = next_resid++;
parent->children = list_push((list_t*)parent->children, (void*) new_file);
parent->size++;
v();
return TRUE;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment