aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/spf13/afero/memmap.go
diff options
context:
space:
mode:
authorNiall Sheridan <nsheridan@gmail.com>2017-10-18 13:15:14 +0100
committerNiall Sheridan <niall@intercom.io>2017-10-18 13:25:46 +0100
commit7b320119ba532fd409ec7dade7ad02011c309599 (patch)
treea39860f35b55e6cc499f8f5bfa969138c5dd6b73 /vendor/github.com/spf13/afero/memmap.go
parent7c99874c7a3e7a89716f3ee0cdf696532e35ae35 (diff)
Update dependencies
Diffstat (limited to 'vendor/github.com/spf13/afero/memmap.go')
-rw-r--r--vendor/github.com/spf13/afero/memmap.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/vendor/github.com/spf13/afero/memmap.go b/vendor/github.com/spf13/afero/memmap.go
index 767ac1d..09498e7 100644
--- a/vendor/github.com/spf13/afero/memmap.go
+++ b/vendor/github.com/spf13/afero/memmap.go
@@ -66,7 +66,10 @@ func (m *MemMapFs) unRegisterWithParent(fileName string) error {
if parent == nil {
log.Panic("parent of ", f.Name(), " is nil")
}
+
+ parent.Lock()
mem.RemoveFromMemDir(parent, f)
+ parent.Unlock()
return nil
}
@@ -99,8 +102,10 @@ func (m *MemMapFs) registerWithParent(f *mem.FileData) {
}
}
+ parent.Lock()
mem.InitializeDir(parent)
mem.AddToMemDir(parent, f)
+ parent.Unlock()
}
func (m *MemMapFs) lockfreeMkdir(name string, perm os.FileMode) error {
@@ -136,7 +141,7 @@ func (m *MemMapFs) Mkdir(name string, perm os.FileMode) error {
m.registerWithParent(item)
m.mu.Unlock()
- m.Chmod(name, perm)
+ m.Chmod(name, perm|os.ModeDir)
return nil
}
@@ -146,9 +151,8 @@ func (m *MemMapFs) MkdirAll(path string, perm os.FileMode) error {
if err != nil {
if err.(*os.PathError).Err == ErrFileExists {
return nil
- } else {
- return err
}
+ return err
}
return nil
}