mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
Handling error condition in loadspec
Signed-off-by: Rajasekaran <rajasec79@gmail.com>
This commit is contained in:
@@ -220,12 +220,12 @@ func loadSpec(cPath string) (spec *specs.LinuxSpec, err error) {
|
|||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
return nil, fmt.Errorf("JSON specification file %s not found", cPath)
|
return nil, fmt.Errorf("JSON specification file %s not found", cPath)
|
||||||
}
|
}
|
||||||
return spec, err
|
return nil, err
|
||||||
}
|
}
|
||||||
defer cf.Close()
|
defer cf.Close()
|
||||||
|
|
||||||
if err = json.NewDecoder(cf).Decode(&spec); err != nil {
|
if err = json.NewDecoder(cf).Decode(&spec); err != nil {
|
||||||
return spec, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return spec, validateSpec(spec)
|
return spec, validateSpec(spec)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user