Browse code

don't open bind mounted files/dirs to get Stat, use os.Lstat

Daniel Garcia authored on 2013/12/11 03:49:53
Showing 1 changed files
... ...
@@ -801,15 +801,10 @@ func (container *Container) createVolumes() error {
801 801
 			if strings.ToLower(bindMap.Mode) == "rw" {
802 802
 				srcRW = true
803 803
 			}
804
-			if file, err := os.Open(bindMap.SrcPath); err != nil {
804
+			if stat, err := os.Lstat(bindMap.SrcPath); err != nil {
805 805
 				return err
806 806
 			} else {
807
-				defer file.Close()
808
-				if stat, err := file.Stat(); err != nil {
809
-					return err
810
-				} else {
811
-					volIsDir = stat.IsDir()
812
-				}
807
+				volIsDir = stat.IsDir()
813 808
 			}
814 809
 			// Otherwise create an directory in $ROOT/volumes/ and use that
815 810
 		} else {