Skip to content

Commit

Permalink
Fix 'too many fds' for no hashing mode
Browse files Browse the repository at this point in the history
  • Loading branch information
TheDiscordian committed Jun 2, 2021
1 parent 173787f commit cf11f39
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions db.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit cf11f39

Please sign in to comment.