summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/spf13/afero/memmap.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/spf13/afero/memmap.go')
-rw-r--r--vendor/github.com/spf13/afero/memmap.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/vendor/github.com/spf13/afero/memmap.go b/vendor/github.com/spf13/afero/memmap.go
index ea0798d8..d06975e7 100644
--- a/vendor/github.com/spf13/afero/memmap.go
+++ b/vendor/github.com/spf13/afero/memmap.go
@@ -142,6 +142,11 @@ func (m *MemMapFs) Mkdir(name string, perm os.FileMode) error {
}
m.mu.Lock()
+ // Dobule check that it doesn't exist.
+ if _, ok := m.getData()[name]; ok {
+ m.mu.Unlock()
+ return &os.PathError{Op: "mkdir", Path: name, Err: ErrFileExists}
+ }
item := mem.CreateDir(name)
mem.SetMode(item, os.ModeDir|perm)
m.getData()[name] = item