From 79c12b29987291777a59f32ba254f17e1900c967 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Fri, 22 Mar 2019 20:00:20 -0700 Subject: [PATCH] add: check close errors License: MIT Signed-off-by: Steven Allen --- core/coreunix/add.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/core/coreunix/add.go b/core/coreunix/add.go index 2d844a04cf9e..66cf23d32bca 100644 --- a/core/coreunix/add.go +++ b/core/coreunix/add.go @@ -399,10 +399,13 @@ func (adder *dirAdderJob) addDir(path string, dir files.Directory) error { for it.Next() { fpath := gopath.Join(path, it.Name()) node := it.Node() - err := adder.addFileNode(fpath, node) - node.Close() - if err != nil { - return err + err1 := adder.addFileNode(fpath, node) + err2 := node.Close() + switch { + case err1 != nil: + return err1 + case err2 != nil: + return err2 } }