浏览代码

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 {
-	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 {

+ 1 - 1
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")
 	}