From 84f6fce2407129889a1f55e35016049215ef139e Mon Sep 17 00:00:00 2001 From: Darren Stahl Date: Wed, 28 Mar 2018 18:02:45 -0700 Subject: [PATCH] Make hcsshim layerwriter close a fatal error Signed-off-by: Darren Stahl --- archive/tar_windows.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/archive/tar_windows.go b/archive/tar_windows.go index 80edcbbe0..025796a7b 100644 --- a/archive/tar_windows.go +++ b/archive/tar_windows.go @@ -35,7 +35,6 @@ import ( "github.com/Microsoft/go-winio" "github.com/Microsoft/hcsshim" - "github.com/containerd/containerd/log" "github.com/containerd/containerd/sys" ) @@ -180,8 +179,12 @@ func applyWindowsLayer(ctx context.Context, root string, tr *tar.Reader, options return 0, err } defer func() { - if err := w.Close(); err != nil { - log.G(ctx).Errorf("failed to close layer writer: %v", err) + if err2 := w.Close(); err2 != nil { + // This error should not be discarded as a failure here + // could result in an invalid layer on disk + if err == nil { + err = err2 + } } }()