From cf11f394e2db8db8fd87d6a4c449edb0a60440ec Mon Sep 17 00:00:00 2001 From: TheDiscordian Date: Wed, 2 Jun 2021 18:27:21 -0400 Subject: [PATCH] Fix 'too many fds' for no hashing mode --- db.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/db.go b/db.go index e9a1261..12dfd54 100644 --- a/db.go +++ b/db.go @@ -71,14 +71,12 @@ func GetHashValue(fpath string, dontHash bool) []byte { if err != nil { return nil } + defer f.Close() if !dontHash { hash := xxhash.New() if _, err := io.Copy(hash, f); err != nil { - f.Close() return nil } - f.Close() - return hash.Sum(nil) } else { fi, err := f.Stat()