Browse Source

image: Unmount before removing device in error paths

The device remove fails unless we unmount first
Alexander Larsson 12 years ago
parent
commit
41399ac005
1 changed files with 1 additions and 0 deletions
  1. 1 0
      image.go

+ 1 - 0
image.go

@@ -421,6 +421,7 @@ func (image *Image) ensureImageDevice(devices DeviceSet) error {
 
 	err = image.applyLayer(layerPath(root), mountDir)
 	if err != nil {
+		_ = devices.UnmountDevice(image.ID, mountDir)
 		_ = devices.RemoveDevice(image.ID)
 		return err
 	}