mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-10 21:53:57 +08:00
Error handling when container not exists
Signed-off-by: rajasec <rajasec79@gmail.com> Error handling when container not exists Signed-off-by: rajasec <rajasec79@gmail.com> Error handling when container not exists Signed-off-by: rajasec <rajasec79@gmail.com> Error handling when container not exists Signed-off-by: rajasec <rajasec79@gmail.com>
This commit is contained in:
@@ -188,7 +188,7 @@ func (l *LinuxFactory) Load(id string) (Container, error) {
|
||||
return nil, newGenericError(fmt.Errorf("invalid root"), ConfigInvalid)
|
||||
}
|
||||
containerRoot := filepath.Join(l.Root, id)
|
||||
state, err := l.loadState(containerRoot)
|
||||
state, err := l.loadState(containerRoot, id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -273,11 +273,11 @@ func (l *LinuxFactory) StartInitialization() (err error) {
|
||||
return i.Init()
|
||||
}
|
||||
|
||||
func (l *LinuxFactory) loadState(root string) (*State, error) {
|
||||
func (l *LinuxFactory) loadState(root, id string) (*State, error) {
|
||||
f, err := os.Open(filepath.Join(root, stateFilename))
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return nil, newGenericError(err, ContainerNotExists)
|
||||
return nil, newGenericError(fmt.Errorf("container %q does not exists", id), ContainerNotExists)
|
||||
}
|
||||
return nil, newGenericError(err, SystemError)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user