Make hcsshim layerwriter close a fatal error
Signed-off-by: Darren Stahl <darst@microsoft.com>
This commit is contained in:
		| @@ -35,7 +35,6 @@ import ( | |||||||
|  |  | ||||||
| 	"github.com/Microsoft/go-winio" | 	"github.com/Microsoft/go-winio" | ||||||
| 	"github.com/Microsoft/hcsshim" | 	"github.com/Microsoft/hcsshim" | ||||||
| 	"github.com/containerd/containerd/log" |  | ||||||
| 	"github.com/containerd/containerd/sys" | 	"github.com/containerd/containerd/sys" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| @@ -180,8 +179,12 @@ func applyWindowsLayer(ctx context.Context, root string, tr *tar.Reader, options | |||||||
| 		return 0, err | 		return 0, err | ||||||
| 	} | 	} | ||||||
| 	defer func() { | 	defer func() { | ||||||
| 		if err := w.Close(); err != nil { | 		if err2 := w.Close(); err2 != nil { | ||||||
| 			log.G(ctx).Errorf("failed to close layer writer: %v", err) | 			// This error should not be discarded as a failure here | ||||||
|  | 			// could result in an invalid layer on disk | ||||||
|  | 			if err == nil { | ||||||
|  | 				err = err2 | ||||||
|  | 			} | ||||||
| 		} | 		} | ||||||
| 	}() | 	}() | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Darren Stahl
					Darren Stahl