diff --git a/libnetwork/endpoint.go b/libnetwork/endpoint.go index 6d757001b1..7ef8459f31 100644 --- a/libnetwork/endpoint.go +++ b/libnetwork/endpoint.go @@ -297,12 +297,7 @@ func (ep *endpoint) processOptions(options ...EndpointOption) { } func createBasePath(dir string) error { - err := os.MkdirAll(dir, 0644) - if err != nil && !os.IsExist(err) { - return err - } - - return nil + return os.MkdirAll(dir, 0644) } func createFile(path string) error { diff --git a/libnetwork/sandbox/namespace_linux.go b/libnetwork/sandbox/namespace_linux.go index 3ab011cd1c..214da312d0 100644 --- a/libnetwork/sandbox/namespace_linux.go +++ b/libnetwork/sandbox/namespace_linux.go @@ -48,7 +48,7 @@ func init() { func createBasePath() { err := os.MkdirAll(prefix, 0644) - if err != nil && !os.IsExist(err) { + if err != nil { panic("Could not create net namespace path directory") }