vendor/github.com/spf13/afero/memmap.go
changeset 265 05c40b36d3b2
parent 260 445e01aede7e
--- a/vendor/github.com/spf13/afero/memmap.go	Thu Sep 22 16:37:07 2022 +0200
+++ b/vendor/github.com/spf13/afero/memmap.go	Sat Feb 04 12:58:35 2023 +0100
@@ -142,6 +142,11 @@
 	}
 
 	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