Browse code

devmapper: Fix UnmountDevice for non-existing device

Properly error out if passed an id that doesn't exist.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)

Alexander Larsson authored on 2014/02/07 06:26:09
Showing 1 changed files
... ...
@@ -847,6 +847,9 @@ func (devices *DeviceSet) UnmountDevice(hash string, mode UnmountMode) error {
847 847
 	defer devices.Unlock()
848 848
 
849 849
 	info := devices.Devices[hash]
850
+	if info == nil {
851
+		return fmt.Errorf("UnmountDevice: no such device %s\n", hash)
852
+	}
850 853
 
851 854
 	if mode == UnmountFloat {
852 855
 		if info.floating {