Merge pull request #3915 from crosbymichael/no-double-put

No no put put
This commit is contained in:
unclejack 2014-02-03 16:40:44 -08:00
commit b5d6208ccf
2 changed files with 8 additions and 4 deletions

View file

@ -1416,9 +1416,12 @@ func (container *Container) ExportRw() (archive.Archive, error) {
if container.runtime == nil {
return nil, fmt.Errorf("Can't load storage driver for unregistered container %s", container.ID)
}
defer container.Unmount()
return container.runtime.Diff(container)
archive, err := container.runtime.Diff(container)
if err != nil {
container.Unmount()
return nil, err
}
return EofReader(archive, func() { container.Unmount() }), nil
}
func (container *Container) Export() (archive.Archive, error) {
@ -1428,6 +1431,7 @@ func (container *Container) Export() (archive.Archive, error) {
archive, err := archive.Tar(container.basefs, archive.Uncompressed)
if err != nil {
container.Unmount()
return nil, err
}
return EofReader(archive, func() { container.Unmount() }), nil

View file

@ -163,7 +163,7 @@ func (img *Image) TarLayer() (arch archive.Archive, err error) {
}
defer func() {
if err == nil {
if err != nil {
driver.Put(img.ID)
}
}()