Handle error from GetDevice early
Upstream-commit: 89f64712faecddbfd92c7bfe6612dd5890c966dd
Component: engine
This commit is contained in:
Michael Crosby
2014-08-26 10:53:40 -07:00
2 changed files with 16 additions and 2 deletions
+2 -2
View File
@@ -230,10 +230,10 @@ func populateCommand(c *Container, env []string) error {
userSpecifiedDevices := make([]*devices.Device, len(c.hostConfig.Devices))
for i, deviceMapping := range c.hostConfig.Devices {
device, err := devices.GetDevice(deviceMapping.PathOnHost, deviceMapping.CgroupPermissions)
device.Path = deviceMapping.PathInContainer
if err != nil {
return fmt.Errorf("error gathering device information while adding custom device %s", err)
return fmt.Errorf("error gathering device information while adding custom device %q: %s", deviceMapping.PathOnHost, err)
}
device.Path = deviceMapping.PathInContainer
userSpecifiedDevices[i] = device
}
allowedDevices := append(devices.DefaultAllowedDevices, userSpecifiedDevices...)