libcontainerd/client: Fix checkpoint not being set

`cp` variable is used later to populate the `info.Checkpoint` field
option used by Task creation.
Previous changes mistakenly changed assignment of the `cp` variable to
declaration of a new variable that's scoped only to the if block.

Restore the old assignment behavior.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
Paweł Gronowski 2023-03-01 14:16:47 +01:00
parent a48f19157a
commit 0c751f904f
No known key found for this signature in database
GPG key ID: B85EFCFE26DEF92A

View file

@ -154,7 +154,8 @@ func (c *container) Start(ctx context.Context, checkpointDir string, withStdin b
if checkpointDir != "" { if checkpointDir != "" {
// write checkpoint to the content store // write checkpoint to the content store
tar := archive.Diff(ctx, "", checkpointDir) tar := archive.Diff(ctx, "", checkpointDir)
cp, err := c.client.writeContent(ctx, images.MediaTypeContainerd1Checkpoint, checkpointDir, tar) var err error
cp, err = c.client.writeContent(ctx, images.MediaTypeContainerd1Checkpoint, checkpointDir, tar)
// remove the checkpoint when we're done // remove the checkpoint when we're done
defer func() { defer func() {
if cp != nil { if cp != nil {