Skip to content

Commit

Permalink
shimv2: check correct error variable for deferred func in service#Sta…
Browse files Browse the repository at this point in the history
…rtShim

In service#StartShim, there is no applicable error variable which is checked by deferred func because the err variable is redefined.
This PR fixes the error variable.

Fixes #2727

Signed-off-by: Ted Yu <yuzhihong@gmail.com>
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
  • Loading branch information
tedyu authored and fidencio committed Jun 23, 2020
1 parent ac9cc96 commit 8e3bd35
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/runtime/containerd-shim-v2/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,10 @@ func (s *service) StartShim(ctx context.Context, id, containerdBinary, container

// make sure to wait after start
go cmd.Wait()
if err := cdshim.WritePidFile("shim.pid", cmd.Process.Pid); err != nil {
if err = cdshim.WritePidFile("shim.pid", cmd.Process.Pid); err != nil {
return "", err
}
if err := cdshim.WriteAddress("address", address); err != nil {
if err = cdshim.WriteAddress("address", address); err != nil {
return "", err
}
return address, nil
Expand Down

0 comments on commit 8e3bd35

Please sign in to comment.