Преглед на файлове

Merge pull request #422 from kolyshkin/mkdirall

Simplify and fix os.MkdirAll() usage
aboch преди 10 години
родител
ревизия
827b2c667a
променени са 2 файла, в които са добавени 2 реда и са изтрити 7 реда
  1. 1 6
      libnetwork/endpoint.go
  2. 1 1
      libnetwork/sandbox/namespace_linux.go

+ 1 - 6
libnetwork/endpoint.go

@@ -297,12 +297,7 @@ func (ep *endpoint) processOptions(options ...EndpointOption) {
 }
 }
 
 
 func createBasePath(dir string) error {
 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 {
 func createFile(path string) error {

+ 1 - 1
libnetwork/sandbox/namespace_linux.go

@@ -48,7 +48,7 @@ func init() {
 
 
 func createBasePath() {
 func createBasePath() {
 	err := os.MkdirAll(prefix, 0644)
 	err := os.MkdirAll(prefix, 0644)
-	if err != nil && !os.IsExist(err) {
+	if err != nil {
 		panic("Could not create net namespace path directory")
 		panic("Could not create net namespace path directory")
 	}
 	}