From 6150ae89d6d6febbdf11db131697532f8e71e0b3 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Sun, 3 Nov 2019 12:23:58 +0000 Subject: [PATCH] vfs: add a newly created file straight into the directory --- vfs/file.go | 4 ++++ 1 file changed, 4 insertions(+) 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 }