vfs: add a newly created file straight into the directory

This commit is contained in:
Nick Craig-Wood 2019-11-03 12:23:58 +00:00
parent 1e423d21e1
commit 6150ae89d6

View File

@ -589,6 +589,10 @@ func (f *File) Open(flags int) (fd Handle, err error) {
fs.Errorf(f, "Can't figure out how to open with flags: 0x%X", flags)
return nil, EPERM
}
// if creating a file, add the file to the directory
if err == nil && flags&os.O_CREATE != 0 {
f.d.addObject(f)
}
return fd, err
}