Skip to content

Commit bb2db7b

Browse files
committed
libct: drop error from (*Container).currentState return
This function never returns error since 2016 (commit 556f798), so let's remove it. Signed-off-by: Kir Kolyshkin <[email protected]>
1 parent c8395b6 commit bb2db7b

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

libcontainer/container_linux.go

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func (c *Container) Status() (Status, error) {
9999
func (c *Container) State() (*State, error) {
100100
c.m.Lock()
101101
defer c.m.Unlock()
102-
return c.currentState()
102+
return c.currentState(), nil
103103
}
104104

105105
// OCIState returns the current container's state information.
@@ -666,10 +666,7 @@ func (c *Container) newInitProcess(p *Process, cmd *exec.Cmd, comm *processComm)
666666

667667
func (c *Container) newSetnsProcess(p *Process, cmd *exec.Cmd, comm *processComm) (*setnsProcess, error) {
668668
cmd.Env = append(cmd.Env, "_LIBCONTAINER_INITTYPE="+string(initSetns))
669-
state, err := c.currentState()
670-
if err != nil {
671-
return nil, fmt.Errorf("unable to get container state: %w", err)
672-
}
669+
state := c.currentState()
673670
// for setns process, we don't have to set cloneflags as the process namespaces
674671
// will only be set via setns syscall
675672
data, err := c.bootstrapData(0, state.NamespacePaths)
@@ -847,12 +844,8 @@ func (c *Container) updateState(process parentProcess) (*State, error) {
847844
if process != nil {
848845
c.initProcess = process
849846
}
850-
state, err := c.currentState()
851-
if err != nil {
852-
return nil, err
853-
}
854-
err = c.saveState(state)
855-
if err != nil {
847+
state := c.currentState()
848+
if err := c.saveState(state); err != nil {
856849
return nil, err
857850
}
858851
return state, nil
@@ -938,7 +931,7 @@ func (c *Container) isPaused() (bool, error) {
938931
return state == configs.Frozen, nil
939932
}
940933

941-
func (c *Container) currentState() (*State, error) {
934+
func (c *Container) currentState() *State {
942935
var (
943936
startTime uint64
944937
externalDescriptors []string
@@ -982,7 +975,7 @@ func (c *Container) currentState() (*State, error) {
982975
}
983976
}
984977
}
985-
return state, nil
978+
return state
986979
}
987980

988981
func (c *Container) currentOCIState() (*specs.State, error) {

0 commit comments

Comments
 (0)