1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #28950 from stevvooe/symlink-check-err

tarexport: check symlink error when saving layer
This commit is contained in:
Brian Goff 2016-11-29 19:56:16 -05:00 committed by GitHub
commit 8e0794aae0

View file

@ -17,6 +17,7 @@ import (
"github.com/docker/docker/pkg/archive" "github.com/docker/docker/pkg/archive"
"github.com/docker/docker/pkg/system" "github.com/docker/docker/pkg/system"
"github.com/docker/docker/reference" "github.com/docker/docker/reference"
"github.com/pkg/errors"
) )
type imageDescriptor struct { type imageDescriptor struct {
@ -313,7 +314,9 @@ func (s *saveSession) saveLayer(id layer.ChainID, legacyImg image.V1Image, creat
if err != nil { if err != nil {
return distribution.Descriptor{}, err return distribution.Descriptor{}, err
} }
os.Symlink(relPath, layerPath) if err := os.Symlink(relPath, layerPath); err != nil {
return distribution.Descriptor{}, errors.Wrap(err, "error creating symlink while saving layer")
}
} else { } else {
// Use system.CreateSequential rather than os.Create. This ensures sequential // Use system.CreateSequential rather than os.Create. This ensures sequential
// file access on Windows to avoid eating into MM standby list. // file access on Windows to avoid eating into MM standby list.