diff --git a/vfs/file.go b/vfs/file.go index 2747e958d..aa0e8c434 100644 --- a/vfs/file.go +++ b/vfs/file.go @@ -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 }