Skip to content

Commit

Permalink
add: check close errors
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Steven Allen <steven@stebalien.com>
  • Loading branch information
Stebalien committed Mar 23, 2019
1 parent a72d418 commit 3f76a28
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions core/coreunix/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down

0 comments on commit 3f76a28

Please sign in to comment.