Skip to content

Commit 5461fa3

Browse files
authored
Merge pull request #5196 from Iceber/fix-rootfs
rootfs: fix the error handling of the snapshotter.Commit
2 parents 6b410ba + 4e8b2f3 commit 5461fa3

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

rootfs/init.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func InitRootFS(ctx context.Context, name string, parent digest.Digest, readonly
6767
return snapshotter.Prepare(ctx, name, parentS)
6868
}
6969

70-
func createInitLayer(ctx context.Context, parent, initName string, initFn func(string) error, snapshotter snapshots.Snapshotter, mounter Mounter) (string, error) {
70+
func createInitLayer(ctx context.Context, parent, initName string, initFn func(string) error, snapshotter snapshots.Snapshotter, mounter Mounter) (_ string, retErr error) {
7171
initS := fmt.Sprintf("%s %s", parent, initName)
7272
if _, err := snapshotter.Stat(ctx, initS); err == nil {
7373
return initS, nil
@@ -87,7 +87,7 @@ func createInitLayer(ctx context.Context, parent, initName string, initFn func(s
8787
}
8888

8989
defer func() {
90-
if err != nil {
90+
if retErr != nil {
9191
if rerr := snapshotter.Remove(ctx, td); rerr != nil {
9292
log.G(ctx).Errorf("Failed to remove snapshot %s: %v", td, rerr)
9393
}

0 commit comments

Comments
 (0)