From 628799a42fb157b4c3145fed7c33e3e607e39c95 Mon Sep 17 00:00:00 2001 From: Ted Yu Date: Sat, 30 Nov 2019 08:42:49 -0800 Subject: [PATCH] vc: Check return value from os.MkdirAll in virtiofsdArgs Fixes #2297 Signed-off-by: Ted Yu yuzhihong@gmail.com --- virtcontainers/clh.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/virtcontainers/clh.go b/virtcontainers/clh.go index d5491058c2..80e63b3117 100644 --- a/virtcontainers/clh.go +++ b/virtcontainers/clh.go @@ -662,7 +662,9 @@ func (clh *cloudHypervisor) virtiofsdArgs(sockPath string) ([]string, error) { sourcePath := filepath.Join(kataHostSharedDir(), clh.id) if _, err := os.Stat(sourcePath); os.IsNotExist(err) { - os.MkdirAll(sourcePath, os.ModePerm) + if err = os.MkdirAll(sourcePath, os.ModePerm); err != nil { + return nil, err + } } args := []string{