From 39e4a0bc9e3a25b39083e21646a67e67939e3613 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Thu, 14 Nov 2013 22:56:18 +0100 Subject: [PATCH] ApplyLayer() use RemoveAll to handle removing directories rmTargetPath can be a directory, so we have to use RemoveAll() or we will fail to whiteout non-empty directories. Upstream-commit: 006e2a600ce689770ba2c49805bc4f634976f365 Component: engine --- components/engine/archive/diff.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/engine/archive/diff.go b/components/engine/archive/diff.go index 0e4fe3fcc2..877d076c8b 100644 --- a/components/engine/archive/diff.go +++ b/components/engine/archive/diff.go @@ -49,7 +49,7 @@ func ApplyLayer(dest string, layer Archive) error { rmTargetPath := filepath.Join(filepath.Dir(fullPath), rmTargetName) // Remove the file targeted by the whiteout log.Printf("Removing whiteout target %s", rmTargetPath) - _ = os.Remove(rmTargetPath) + _ = os.RemoveAll(rmTargetPath) // Remove the whiteout itself log.Printf("Removing whiteout %s", fullPath) _ = os.RemoveAll(fullPath)