Commit 6d1a70ef authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Check for children overwrite only in paranoia mode.

parent 427d1580
...@@ -128,10 +128,13 @@ func (me *inode) setParent(newParent *inode) { ...@@ -128,10 +128,13 @@ func (me *inode) setParent(newParent *inode) {
} }
if newParent != nil { if newParent != nil {
me.Parent = newParent me.Parent = newParent
if paranoia {
ch := me.Parent.Children[me.Name] ch := me.Parent.Children[me.Name]
if ch != nil { if ch != nil {
panic(fmt.Sprintf("Already have an inode with same name: %v: %v", me.Name, ch)) panic(fmt.Sprintf("Already have an inode with same name: %v: %v", me.Name, ch))
} }
}
me.Parent.Children[me.Name] = me me.Parent.Children[me.Name] = me
} }
......
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