瀏覽代碼

Merge pull request #5068 from tianon/fix-abs-volume-check

Fix edge case in bind mount absolute path detection
unclejack 11 年之前
父節點
當前提交
1bcb9ce69e
共有 1 個文件被更改,包括 2 次插入6 次删除
  1. 2 6
      runtime/volumes.go

+ 2 - 6
runtime/volumes.go

@@ -177,12 +177,8 @@ func createVolumes(container *Container) error {
 		if bindMap, exists := binds[volPath]; exists {
 			isBindMount = true
 			srcPath = bindMap.SrcPath
-			srcAbs, err := filepath.Abs(srcPath)
-			if err != nil {
-				return err
-			}
-			if srcPath != srcAbs {
-				return fmt.Errorf("%s should be an absolute path", srcPath)
+			if !filepath.IsAbs(srcPath) {
+				return fmt.Errorf("%s must be an absolute path", srcPath)
 			}
 			if strings.ToLower(bindMap.Mode) == "rw" {
 				srcRW = true