tarexport: check symlink error when saving layer

Signed-off-by: Stephen J Day <stephen.day@docker.com>
Upstream-commit: 8616b0690a3ac905fc6ee06ff7524c837fcb8c92
Component: engine
This commit is contained in:
Stephen J Day
2016-11-29 13:08:24 -08:00
parent c0fecf9b2a
commit 0a3180df6c
+4 -1
View File
@@ -17,6 +17,7 @@ import (
"github.com/docker/docker/pkg/archive"
"github.com/docker/docker/pkg/system"
"github.com/docker/docker/reference"
"github.com/pkg/errors"
)
type imageDescriptor struct {
@@ -313,7 +314,9 @@ func (s *saveSession) saveLayer(id layer.ChainID, legacyImg image.V1Image, creat
if err != nil {
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 {
// Use system.CreateSequential rather than os.Create. This ensures sequential
// file access on Windows to avoid eating into MM standby list.