Przeglądaj źródła

Merge pull request #3152 from daniel-garcia/3129_dont-open-bindmounted-files

don't open bind mounted files/dirs to get Stat, use os.Lstat
Victor Vieux 11 lat temu
rodzic
commit
4c6e528f13
1 zmienionych plików z 2 dodań i 7 usunięć
  1. 2 7
      container.go

+ 2 - 7
container.go

@@ -801,15 +801,10 @@ func (container *Container) createVolumes() error {
 			if strings.ToLower(bindMap.Mode) == "rw" {
 				srcRW = true
 			}
-			if file, err := os.Open(bindMap.SrcPath); err != nil {
+			if stat, err := os.Lstat(bindMap.SrcPath); err != nil {
 				return err
 			} else {
-				defer file.Close()
-				if stat, err := file.Stat(); err != nil {
-					return err
-				} else {
-					volIsDir = stat.IsDir()
-				}
+				volIsDir = stat.IsDir()
 			}
 			// Otherwise create an directory in $ROOT/volumes/ and use that
 		} else {