docker/patch/0077-image-fix-file-not-exist-for-check-file-size.patch
2019-09-30 10:37:25 -04:00

33 lines
997 B
Diff

From be262686615a41b7377e5e19c9aae2a1d71cb4fb Mon Sep 17 00:00:00 2001
From: jingrui <jingrui@huawei.com>
Date: Tue, 22 Jan 2019 17:20:38 +0800
Subject: [PATCH 077/111] image: fix file not exist for check file
size
reason: check file size should support file not exist.
Change-Id: Iae3b8d4f477d6cfc51ba71a185a598687f8393a2
Signed-off-by: jingrui <jingrui@huawei.com>
---
components/engine/image/tarexport/load.go | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/components/engine/image/tarexport/load.go b/components/engine/image/tarexport/load.go
index b9f8f7e3ac..34574129f1 100644
--- a/components/engine/image/tarexport/load.go
+++ b/components/engine/image/tarexport/load.go
@@ -432,6 +432,10 @@ func checkValidParent(img, parent *image.Image) bool {
func checkJsonFileSize(path string) error {
fileInfo, err := os.Stat(path)
if err != nil {
+ // path can not exist.
+ if os.IsNotExist(err) {
+ return nil
+ }
return err
}
fileSize := fileInfo.Size()
--
2.17.1